learned/learning/to learn RSS 2.0
# Saturday, 15 December 2012

As you know if you have WinHost $5 or $10 plans, you cannot backup databases from SSMS, you have to do it from the Web Control Panel. After getting tired of doing this manually, I decided to automate this… as I have always been a big fan of automating things. This is how you can do it:

Software Requirements:
Selenium IDE
2. Visual Studio (if you’re going to use C#)
3. Java
Selenium Server
5. Firefox browser

Steps involved:
1. Install Selenium IDE from
here, or open Firefox browser and install from the Add-On page. You should have Firefox installed in your machine.
2. Launch the IDE after installing. This is how the IDE looks:


3. The Selenium IDE starts in recording mode, the red button on the top right corner can be used to start or stop recording.
4. Open a Firefox window, and go to WinHost’s control panel page.
5. Enter your username, password, and follow all the steps that you do for manual database backup. The IDE will record every click event, and you should be able to see the events in the IDE getting added.
6. Once you are done with all the tasks, stop recording.
7. Go to File menu, Export Test Case As and choose C# / NUnit / Remote Control, which will generate a C# class.
8. Create a Console Application or a Service. Console Application works well for me.
9. You need to copy parts of code from the IDE generated class. You can put everything in a method, something like this:

   1:              ISelenium selenium;
   2:              StringBuilder verificationErrors;
   4:              selenium = new DefaultSelenium("localhost", 4444, "*chrome", "https://cp.winhost.com/");
   5:              selenium.Start();
   6:              verificationErrors = new StringBuilder();
   8:              selenium.Open("/login.aspx?ReturnUrl=%2fdefault.aspx");
   9:              selenium.Type("id=ctl00_cphMain_loginCP_UserName", "YourUserId");
  10:              selenium.Type("id=ctl00_cphMain_loginCP_Password", "YourPassword");
  11:              selenium.Click("id=ctl00_cphMain_loginCP_Login");
  12:              selenium.WaitForPageToLoad("30000");
  13:              selenium.Click("id=sites");
  14:              selenium.WaitForPageToLoad("30000");
  15:              selenium.Click("id=ctl00_cphMain_gvSites_ctl02_lbManage");
  16:              selenium.WaitForPageToLoad("30000");
  17:              selenium.Click("css=img[alt=\"Microsoft SQL Manager\"]");
  18:              selenium.WaitForPageToLoad("30000");
  19:              selenium.Click("id=" + labelName);
  20:              selenium.WaitForPageToLoad("30000");
  21:              selenium.Click("link=Backup");
  22:              selenium.WaitForPageToLoad("30000");
  23:              selenium.Click("id=ctl00_cphMain_btnBackup");
  24:              var confirmation = Regex.IsMatch(selenium.GetConfirmation(), "^Create backup\\. Are you sure[\\s\\S]$");
  25:              selenium.WaitForPageToLoad("30000");

10. Install Selenium related DLLs from Nuget. Open Visual Studio’s Package Manager Console, and install packages - Selenium.RC and Selenium.Support
11. Download Selenium Server from
here, you SHOULD have Java installed in your machine to start the server.
12. The server should be started before executing the above code, you can create a .bat file, with this line “java -jar D:\Utils\selenium-server-standalone-2.25.0.jar” in it.
13. You can execute the bat file like this - System.Diagnostics.Process.Start(@"D:\Utils\startSeleniumServer.bat");
14. Now, when you start the console app, it will repeat the recorded steps, and backup your database.
15. Remember, the database will be backed up in the app_data folder; and if the folder already has a backup file, you need to delete it. You could write a FTP module or use the FTP Utility that I wrote (attached) to delete and download the backup file.
16. You have to pass the file path and the credentials if you’re using my FTP utility. The file path will be something like this -

Note: You could use Selenium.WebDriver instead of RC Server, however, it doesn’t handle popup or confirmation window properly; as our process opens a confirmation window, I went with the RC Server.

Download FTP Utility

Saturday, 15 December 2012 17:07:48 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | Miscellaneous | Solutions
# Saturday, 19 March 2011

My WCF Data Service worked fine in the VS Web Server, but when I deployed it to IIS (7.5), it stopped working. I was able to view the service page listing all the entities, but when I tried to access the entities in a RESTFUL manner, I wasn’t.

I found out the problem by setting

config.UseVerboseErrors = true; 
public static void InitializeService(DataServiceConfiguration config)

The problem was I was using windows authentication to connect to my database, after changing to SQL Server Authentication, everything worked fine.

Spent hours in figuring out this…

Saturday, 19 March 2011 15:57:32 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | Solutions
# Thursday, 06 May 2010

If audio is not working in your server, check whether Windows Audio service is started…

How to do:
1. On Windows Run (windows key + R key), type services.msc
2. Look for Windows Audio service and check whether it is started, if not, start it

If this doesn't resolve your problem, try updating your audio drivers.

If audio is not working only when remoting, try the following:

1. On Windows Run (windows key + R key), type gpedit.msc
2. Go to Local Computer Policy/Computer Configuration/Administrative Templates/Windows Components/Terminal Services/ClientServer redirection
3. Enable Allow audio redirection

and then do this too:
1. On Windows Run (windows key + R key), type tscc.msc
2. Open the Connections folder in the left sidebar
3. Right-click RDP-Tcp, select Properties
4. Click Client Settings tab
5. UNCHECK the "Audio mapping" checkbox under the section "Disable the following:"
7. Click OK, and close tscc
8. You may see a warning which says this change will not take effect for any currently-connected RDP sessions. Click out of that
9. Logoff
10. Login

If you are remoting from a Windows XP machine, try to remote into the console by typing "mstsc /console" on run window.
If you are remoting from a Windows 7 or a Vista machine, try to remote into the console by typing "mstsc /admin" on run window.

Thursday, 06 May 2010 23:53:56 (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
Miscellaneous | Solutions
# Wednesday, 05 May 2010

After upgrading my PC from Windows XP to Windows 7, an external hard drive which was working fine on XP lost write permissions.

Found a solution:

1. Right click on the drive icon for the external drive.
2. Select Properties
3. Click Security Tab
4. Click Advanced Button
5. Click Owner Tab
6. Click Edit Button
7. Choose your account or administrators group, whichever you want to give permissions
8. Check 'Replace owner on subcontainers and objects'
9. Click OK

If this doesn’t resolve your problem, choose the user from “Group or user names” list, click “Edit”, and give appropriate permissions.

Hope this works for you!

Wednesday, 05 May 2010 05:15:42 (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
Miscellaneous | Solutions
# Monday, 26 April 2010
If you are getting “None of the products that are addressed by this software update are installed on this computer. Click cancel to exit setup” (the popup below) while trying to install Visual Studio Team System 2008 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010 (this allows to use the Team Foundation Server 2010 server with Team Explorer 2008 SP1 client) , first install VS 2008 SP1 (not 3.5 SP1) and then try installing the compatibility update.

Monday, 26 April 2010 16:21:03 (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
.NET | Solutions
# Wednesday, 09 December 2009
Can anybody find the difference between the first and the second ‘testing abc’ in this file test.txt (.02 KB). Open the file and search for ‘testing’ (there should be 2 matches), ‘abc’ (2 matches) and then ‘testing abc’ (1 match). It is because the ‘space’ between the two words varies, one is a regular space and the other is a html space (not nbsp), their ascii values are 32 and 160 respectively. I figured this after converting the spaces to ascii values! (spent almost an hour)

Wednesday, 09 December 2009 20:44:20 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | Solutions
We can take an ASP.NET 2.0 application offline temporarily by uploading a file called app_offline.htm to the root directory.  It will shut-down the application, unload the application domain from the server, and stop processing any new incoming requests for that application.

To know more about this - http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

Working around the "IE Friendly Errors" feature - http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx

I came to know this only today when I was listening to Hansel minutes, this will definitely help me in taking my website down easily.

Wednesday, 09 December 2009 20:36:59 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | Solutions
This is for my future reference.

If you are using sitemap as the data source for the menu control, then you can set the property ShowStartingNode = "false" of sitemapdatasource.  Inorder to hide the arrow image, set the properties DynamicEnableDefaultPopOutImage = "False" and StaticEnableDefaultPopoutImage = "False" of the menu control.
Wednesday, 09 December 2009 16:28:18 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | For Future Reference | Solutions
# Monday, 16 November 2009

 I was trying to add AJAX Control Toolkit to my Toolbox, for some reason Visual Studio was crashing. I found a solution for it, see this works out for you – start Visual Studio in safe mode (go to Visual Studio’s command prompt and execute ‘devenv /safemode’) and then try to add items to your toolbox, I was able to do it! There might be a better solution for this, please let me know if there is one.

Monday, 16 November 2009 15:04:38 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET | Solutions
# Friday, 23 October 2009

Solutions for postback problem:
1. Add "<base target = “_self” />" inside <head> tag of the popup.
2. You can use window.open instead of window.showModalDialog.

Solutions for session transfer problem:

1. You can use window.open instead of window.showModalDialog.

2. You can use AJAX modal popup.


This seems to be a IE bug (working fine in firefox and chrome), I have this problem if I open the .NET application after opening an instance of IE (say google.com) whereas if I open the former before the latter, things are fine.

Please let me know if anybody has any good solution for this.

Friday, 23 October 2009 12:07:04 (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
.NET | Solutions
<2017 April>
About the author/Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2017
Sign In
Total Posts: 41
This Year: 0
This Month: 0
This Week: 0
Comments: 47
Pick a theme:
All Content © 2017, Gokulnath
DasBlog theme 'Business' created by Christoph De Baene (delarou)
The new movement has made a number of changes. First, precise instantaneous jump calendar display tag heuer replica large switching time is scheduled for midnight. The power required for this process will slowly build up within hours. Furthermore, LANGE 1 escapement now available eccentric balance weight balance wheel and homemade free omega uk watch sprung. Means provided in the hand-carved balance wheel splint omega replica underneath, 21,600 vibrations per hour. This table also hublot replica retains the reliable double-barrel, power reserve of 72 hours.