I have a ASP.NET WEB application and I added a Class to that app.
Lets call it a.cs
In this class in have:
using System.Web;
Still for the following line:
Server.MapPath("~\\bin\\error.txt")
I get "The name Server does not exist in the current context"
I researched further for the server object but I was directed to :
HttpServerUtility Class
Which appears to have all of the interface of the Server class.
Question: are these same HttpServerUtility
and Server?
Why Server
itself give me the mentioned error?
HttpServerUtility
Class is accessible in the a.cs.
======================= The suggested duplicate solution is not a solution in my case: There the accepted answer is:
You need a reference to the System.Web assembly You need to get the class name right (HttpServerUtility, not HttpServerUtuility) You need to get the method name right (UrlDecode, not URLDecode) You need an instance of the class, as it's an instance method
None of above apply in my case.