Saturday, March 24, 2012

Mappath in .vb file

Hi all
I'm just learning ASPX from a book called ASP.NET unleashed. I'm on chapter 6 which explains about code behind.
One part of code is a doRegister sub where is saves some info to a text file ("c:\textfile.txt") I wanted this changed to save the info into my local website under "~/data/textfile.txt" so I used mappath. I've used this in previous code and worked well. The only difference is that this is in a .VB class file and needs to be compiled into a DLL.
When compiling I'm getting the following error (not sure on exact wording as I'm currently at work)
MapPath not declared.
I use
vbc /t:library /r:system.dll /out:../bin/file.dll doregister.vb
What do I need to reference to get MapPath working in a VB class.
Also, for future reference and for other commands that might not compile how can I find out what to reference in the VBC command line ?

Thanks for any help
Alan.You have to reference System.Web.dll
Thanks for the quick reply

I'll try that when I get home but I'm sure it'll work.
For future reference and for other commands that might not compile how can I find out what to reference in the VBC command line ?

Thanks again
Alan
MSDN is the best source. You have hosting assembly and namespace specified there for each class.

0 comments:

Post a Comment