Jun 18, 2010

'HttpUtility' is not a member of 'Web' in console application VS2010.

Today I started my first console application developmentin VS 2010.

After I added the below code
System.Web.HttpUtility.UrlEncode(item)

and build the application, the system throws the error message like
Error message: 'HttpUtility' is not a member of 'Web'.

This error message suggests to add a reference to System.Web. When I look into it over the reference list, its was not there. I only have "System.Web.ApplicationServices" and "System.Web.Services". I dont know why its not there in the list?

Then my friend said, 'target framework may be different'. After that I checked the target framework, its was .NET Framework 4 Client Profile. Then I changed it as .NET Framework 4. Now my code works fine.

Hope this ll help you.

2 comments:

  1. If you want to change the target framework, here are the instructions:

    http://msdn.microsoft.com/en-us/library/bb398202.aspx

    ReplyDelete
  2. The only way I could find to change the .NET framework version for an existing project using VS2010 was to edit the `*.vbproj` file.

    https://gist.github.com/dhollenbeck/379d7a784636ba86fa8f229cab1e24e7

    ReplyDelete