I have no trouble with MapPath from a WebForm.
Thanks for any suggestions.larrythek1,
System.Web.HttpContext.Current.Server.MapPath("yourfile")
Hope this helps,
cjmaxey
Thanks cjmaxey for your reply--it worked...but since I'm a beginner at asp.net I'd like to understand a bit more about the problem.
1. Why do I need the full path in a Module and not in a Webform? Are there other restrictions in using a Module?
2. How could I have found the full path for Server.MapPath? There were no finds for MapPath from within the Help in VisualStudio?
Thanks again for your help.
Larry from Edgewater NJ, USA
1. When you are in a webform, the Server is a property of the Page class which refers to the HttpServerUtility intrinsic object. When you in a module or class, you aren't inheriting from the Page class.
The module or class can access the ASP.NET intrinsic objects from System.Web.HttpContext.Current.
There are many rules/benefits/tricks to using a module. For those related to this post, I would look into intrinsic objects, the Page class, HttpContext, etc.
2. How could you have found this out? I'm not sure that there is a good way to find these things out other than experience, google, or what you did - posting to asp.net/forums.
cjmaxey
Thanks cjmaxey,
Your explanation was very helpful.
Larry
0 comments:
Post a Comment