HttpRuntime, threading, cache, and Server.MapPath

  • Thread starter Thread starter Random
  • Start date Start date
R

Random

I am running some threaded operations within my ASP.NET app, in order to add
some data to the Cache. I know enough to use the HttpRuntime.Cache instead
of the HttpContext.Cache, but my operations need to reference a file on the
server. Normally, I'd use Server.MapPath to get the file reference, but I
can't do that within the thread. What can I use instead?

I'd tried using Server.MapPath in Application_Start to give it to an
Application variable, but I can't reference Application in my thread either.
 
Random said:
I am running some threaded operations within my ASP.NET app, in order to
add some data to the Cache. I know enough to use the HttpRuntime.Cache
instead of the HttpContext.Cache, but my operations need to reference a
file on the server. Normally, I'd use Server.MapPath to get the file
reference, but I can't do that within the thread. What can I use instead?

I'd tried using Server.MapPath in Application_Start to give it to an
Application variable, but I can't reference Application in my thread
either.

Close. In Application_Start store the physical root in a static (shared in
VB) variable. That you can see from everywhere.


Dvid
 
Back
Top