473,507 Members | 12,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

does not exist in the current context

J
I'm trying to use HttpUtility.UrlEncode method but I get this error "The
name 'HttpUtility' does not exist in the current context". After adding
"using System.Web", then typing in System.Web., IntelliSense just shows 3
methods available (AspNetHostingPermission,AspNetHostingPermissionAt tribute,
and AspNetHostingPermissionLevel) but no HttpUtility. What's up?

Thx,
-j

Code snip:

using System;
using System.Text;
using System.Net;
using System.IO;
using System.Web;

namespace XYZtest
{
class Program
{
static void Main(string[] args)
{
PostInfo();
}
private static void PostInfo()
{
string postData="UID=me";
postData += ("&PWD=mypassword");
postData += ("&DATA=mydata");
postData = HttpUtility.UrlEncode(postData));

Sep 11 '06 #1
2 36884
I'm trying to use HttpUtility.UrlEncode method but I get this error "The name
'HttpUtility' does not exist in the current context". After adding "using
System.Web", then typing in System.Web., IntelliSense just shows 3 methods
available (AspNetHostingPermission,AspNetHostingPermissionAt tribute, and
AspNetHostingPermissionLevel) but no HttpUtility. What's up?
Did you add a reference to System.Web.dll to your project? That is more
important than a "using" clause, as that is no more than a "type
saving" device (meaning: less to type in).

Hans Kesting
Sep 11 '06 #2
J
Thanks for clearing that up for this newbie.

"Hans Kesting" <ne***********@spamgourmet.comwrote in message
news:mn***********************@spamgourmet.com...
>I'm trying to use HttpUtility.UrlEncode method but I get this error "The
name 'HttpUtility' does not exist in the current context". After adding
"using System.Web", then typing in System.Web., IntelliSense just shows 3
methods available
(AspNetHostingPermission,AspNetHostingPermissionA ttribute, and
AspNetHostingPermissionLevel) but no HttpUtility. What's up?

Did you add a reference to System.Web.dll to your project? That is more
important than a "using" clause, as that is no more than a "type saving"
device (meaning: less to type in).

Hans Kesting


Sep 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
23835
by: CuriousGeorge | last post by:
I've upgraded a .Net 1.1 web app to 2.0 and am having a heck of a time getting resources to work again. From what I understand if I move my strings.resx file into the App_GlobalResources folder I...
2
5586
by: aarepasky | last post by:
I am using ASP Web 2005 express and I have a textbox in a user control. Now when I try to use it in another user control, I get the error that it "does not exist in current context. These 2 user...
3
1846
by: j-in-uk | last post by:
Hi, It seems as though Profiles have replaced session variables in visual studio 2005. The Profile needs to be defined in the web.config : <anonymousIdentification enabled="true" /> <profile...
1
7466
by: Arjen | last post by:
Hi, I do this inside a repeater: <% if ((Boolean)((DataRowView)Container.DataItem) == true) { %> <%} %> I get this message: CS0103: The name 'Container' does not exist in the current...
2
9902
by: Jeff | last post by:
hey asp.net 2.0 (C'#) In the code behind file I have this method: public String AddBR(Object param) { String text = (String) param; return text; }
0
1904
by: Dave | last post by:
I have an ASPX page that I can't seem to do anything with the dropdowns. The error that I'm getting is "The name 'EmployeeDropdownList' does not exist in the current context. I have all the...
2
3046
by: =?Utf-8?B?QyNub3ZpY2U=?= | last post by:
Like my name says I am a total novice at C#. I am trying to following examples in a book that I have but unfortunately they do not provide you with code for the whole project. Up till now I could...
1
2975
by: avecreep | last post by:
Hi, i was trying to find a web application and i found one open source on the internet. i put the code folders on the root folder and when i tried to acces via web browser it all worked fine ( i...
6
28415
by: cbellew | last post by:
G'day, I have encontered what appears to be a common problem, but unfortunately the typical solution i have found has not worked for me. I have just copied the files from an "ASP .NET Web Site"...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.