Mapping Paths with no context

M

Michael McDaniel

I have overridden HttpApplication in my class library.

When my application starts, There are configuration files that I need to
load in order for my application to work correctly. This works great,
however, I now have a config file that I need that is located on a
virtual mapped path within iis.

During my HtppApplication load, I have no HttpContext, hence my problem.
How do I map a path when I have no Current Context?


string _VirtualPath = "/settings.config";

System.Web.HttpContext context =
System.Web.HttpContext.Current;
if (File.Exists(System.Web.HttpRuntime.AppDomainAppPath + _VirtualPath))
{
_PhysicalPath =
System.Web.HttpRuntime.AppDomainAppPath + _VirtualPath;
}
else if (context != null)
{
_PhysicalPath = context.Server.MapPath(_VirtualPath);
}
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top