?
Solved

The type or namespace name 'Server' could not be found (are you missing a using directive or an assembly reference?)

Posted on 2004-08-13
7
Medium Priority
?
1,371 Views
Last Modified: 2008-01-09
I use "Server.UrlEncode" in my class, I also have the

using System.Web

directive. How can this sucker not be found?
0
Comment
Question by:RichardFox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11794108
did you import the system.web namespace?
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11794152
if not try using system.web.httpserverutility.urlencode
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:RichardFox
ID: 11794215
AerosSaga, when you ask did I import the namespace, what do you mean? I thought the "using" directive was all I needed
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 500 total points
ID: 11794783
At the top of your class like so:

Imports System.Web.HttpServerUtility
Imports System.Security.Principal
Public Class _Default

Regards,

Aeros
0
 
LVL 20

Expert Comment

by:ihenry
ID: 11794863

Is this compile or run-time error?

Server is a property of System.Web.UI.Page class which is a shortcut to instance of HttpServerUtility class. You shouldn't be able to make a method call like "Server.UrlEncode" if your class is not System.Web.UI.Page or inherits from that class. If that is the case use HttpServerUtility.UrlEncode() instead.

Page.Server Property
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIPageClassServerTopic.asp

HttpServerUtility.UrlEncode Method
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebHttpServerUtilityClassUrlEncodeTopic.asp


HTH
0
 

Author Comment

by:RichardFox
ID: 11794903
Thanks folks, what really puzzled me was that i could call Server.UrlEncode in my Page_Load function (where the class is a child of System.Web.UI.Page), but not in another class which I defined myself. So I came to the same conclusion which jhenry spelled out, and qualified the UrlEncode function with System.Web.HttpUtility.UrlEncode()

THanks for the help
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question