473,395 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 36880
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.