Server.MapPath in a windows application

  • Thread starter Thread starter DaveF
  • Start date Start date
D

DaveF

I want to be able to use Server.MapPath in a windows application. I've added
the system.web reference to my project but whenever I try to call it, I get
a null reference error. Anyone can tell me how to use this function?
(this is how I'm calling it:
System.Web.HttpContext.Current.Server.MapPath() )
 
Hi,

When you run a windows form application there is no web server
to map to. What are you trying to do?


Ken
-------------------------
I want to be able to use Server.MapPath in a windows application. I've added
the system.web reference to my project but whenever I try to call it, I get
a null reference error. Anyone can tell me how to use this function?
(this is how I'm calling it:
System.Web.HttpContext.Current.Server.MapPath() )
 
I think you might be looking for :-
Environment.CurrentDirectory

Hope this helps...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top