Click here to Skip to main content
15,905,913 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hai all,

in my class, i am trying to use Server.MapPath, but it says the name 'Server' does not exist in the current context.How can I fix this problem.
Plz help me.....

thanks in advance...
sham
Posted
Comments
Rajesh Anuhya 11-Oct-10 3:39am    
more clarity required...

Have an Assembly reference of System.Web and you will be able to get access to it.

Read more about it here.[^]
 
Share this answer
 
Comments
Dalek Dave 11-Oct-10 5:40am    
Good Link
Bikash Shrestha From Nepal 11-Oct-10 7:44am    
it works fine in websites but i dont think this works in webapplications' cs file
In Case Of Websites you can use following code to access that object in .cs file

string strPath = System.Web.HttpContext.Current.Server.MapPath("YourDesired Path");
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900