a developer's notes – a semi-technical web development BLOG

December 4, 2013

WebClient .DownloadString with Proxy Server

Filed under: ASP.NET,ASP.NET MVC,C# — Duy Nguyen @ 9:19 am
Tags: , , , , , , ,

Code to use the default proxy settings

IWebProxy defaultWebProxy = WebRequest.DefaultWebProxy;
defaultWebProxy.Credentials = CredentialCache.DefaultCredentials;
client = new WebClient { Proxy = defaultWebProxy };
string downloadString = client.DownloadString("www.google.com");


WebClient client = new WebClient();
WebProxy wp = new WebProxy(" proxy server url here");
client.Proxy = wp;
string str = client.DownloadString("http://www.google.com");

If you need to set an account use this

using (WebClient webClient = new WebClient())
	webClient.Encoding = encoding;
	NetworkCredential netcredit = new NetworkCredential("MyNetworkUserID", "MyNetworkPassword", "corp");
	webClient.Credentials = netcredit;
	webClient.Proxy = new System.Net.WebProxy()
		Credentials = new System.Net.NetworkCredential("MyNetworkUserID", "MyNetworkPassword", "corp")
	// webClient.Proxy = null;//if I don't give webClient.Proxy-it returns Error "407-ProxyAuthentication Required!"
	result = webClient.DownloadString(url);
	  // result = webClient.DownloadString("http://www.google.com/");//just to check with google itself,still the same error

May 13, 2012

How to setup a FTP server in Windows 7

Filed under: Daily Computing — Duy Nguyen @ 11:34 pm
Tags: , , , , , , , , ,

1. Install IIS : Control Panel (Turn Windows Features on or off)
2. Make sure FTP Server is installed

3. Configure Firewall

(Optional. You only need this if you want to host a website from your home computer.)

4. Create a folder on your file system to store your files that you want to host on your FTP server.

5. Create the FTP site. You can follow this guide. http://www.programmerfish.com/how-to-make-local-ftp-server-in-windows-7/ **I suggest you create a user account on your computer to only allow that user to access your page. If you do this, you will need to enable Basic Authentication and disable Anonymous Authentication.

6. Configure your router so that you can use your FTP site from outside your network.

7. Access your FTP site. FTP://yourPublicIpAddress

Here is a great video you can watch on how to do this.

October 28, 2011

How to Uninstall Sql Server Express that gets installed with Visual Studio 2010

Filed under: SQL — Duy Nguyen @ 1:12 pm
Tags: , , , , , , , ,

1. Go to Add/ Remove Programs.
2. Choose “Microsoft SQL Server 2008”
**I had Microsoft SQL Server 2008 R2 installed but you still need to select “Microsoft SQL Server 2008” NOT “Microsoft SQL Server 2008 R2”. If you do choose R2, you will see the SQLEXPRESS instance but you will not be able to select it!

3. Click on the REMOVE link (This will allow you to chose the instance to remove. See image)

4. Select SQLEXPRESS and remove!

September 29, 2011

Why can’t I run my .NET 4.0 site on Windows 2003 with IIS 6?

Filed under: ASP.NET — Duy Nguyen @ 10:44 pm
Tags: , , , , , , , , , , , , , , , , , ,

IIS 6 (that comes with Windows 2003) does not let you have more than one framework at a time running in the same instance like IIS7 that can create Application PoolS targeting different frameworks. This just means a single application pool can’t be used for two different frameworks like IIS7.

You have a two options:

  1. Downgrade the .NET application to 3.5 with Visual Studio 2010. Just go to the Website project properties, Application tab and there is a drop down with all the framework releases, select 3.5.

    VS2010 will reload the project and modify the web.config. If you added A web service reference, thEN you may have to delete them and re-add them under 3.5

  2. Configure IIS6 with a second application pool and a second web site.

    • Create a new application pool…

      and new web site…

      Then assign this application pool to the Framework 4 web application that will be hosted by your new site. To assign the application pool, in the IIS console open the properties section of the web application, and click on the “Home directory” tab and select the application pool which you have created earlier.

    • Then you need to change the ASP.NET version of your application. Right click your virtual directory that hosts your application and click the property and check the ASP.Net. Select Framework 4.

    • Select ASP.NET 4.0 on IIS6 under Web Service Extension. Go to the IIS6 console open “web service extension node” which is right below the “default website” node. You will see the entire ASP.Net framework list that is installed. By default these frameworks might be prohibited so please select ASP.Net Framework 4 and click allow button.

      *If you don’t see ASP.NET 4.0, make sure the framework is installed on the server! If it is, then open a command prompt go to this directory: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
      Then run this command: aspnet_regiis -i

      You will now see ASP.NET 4.0. If you don’t set ASP.NET 4.0 to ALLOW, You will get a “404 Page is not found.”

Check out this great article:


September 5, 2011

Restore failed for Server – RESTORE HEADERONLY is terminating abnormally

Filed under: General Tips — Duy Nguyen @ 2:21 pm
Tags: , , , , ,

I found a great post on this that helped me resolve my problem:


How to find SQL Instances installed and uninstall SQL Server 2005 Express

Filed under: General Tips — Duy Nguyen @ 2:17 pm
Tags: , , , , , ,

Run this script in Management Studio to find what instances are installed:


1. In add/remove find Microsoft SQL Server 2005 Express
2. Uninstall
3. Choose Microsoft SQL Server 2005 Express instances
4. If prompted to do so, stop any Microsoft SQL Server 2005 Express services in services.msc

Enabling a Server Side Disabled Control via Javascript

Filed under: ASP.NET,Javascript / JQuery — Duy Nguyen @ 1:11 pm
Tags: , , , , , ,

I had a ASP.NET check box that I disabled on the code behind code like this:

myCheckBox.Enabled = false;

I wasn’t able to enable it via javascript like this:

myCheckBox.ClientID.disabled = false;

Instead of using

myCheckBox.Enabled = false;

from my code behind. I used this instead

 myCheckBox.InputAttributes.Add(”disabled”, “disabled”);

I got this info from Jonas Bush’s blog post. Check it out in full detail here.
Click Here

Install order for Visual Studio and SQL Server

Filed under: General Tips — Duy Nguyen @ 1:06 pm
Tags: , , , , , ,

Install SQL Server 2005 BEFORE you install Visual Studio 2005/2008. If you install Visual Studio first, you will have a hard time installing SQL Server because Visual Studio , by default, will install SQL Server Express. And when you try to install SQL Server on top of an existing Express installation, you won’t be able to install SQL Server Management Studio.

Blog at WordPress.com.