Server.MapPath from a vb class

M

MattB

I've used this a bit from codebehind with no problems, but now I'm
having some issues when I try to use it from a vb class in my application.
Looking in help, it looks like I need to do something like this:

dim Server As HttpServerUtility
Dim path As String = Server.MapPath("myfile.txt")

----

But any time I use that Server variable I get a null refrence exception.
What am I doing wrong? Thanks!

Matt
 
K

kris kilowatt

Great, I had the same problem, HttpContext.Current.Server.MapPath works
perfect!
 

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

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top