473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

HttpRuntime, threading, cache, and Server.MapPath

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.
Nov 19 '05 #1
2 1792

"Random" <ci*******@hotmail.com> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
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
Nov 19 '05 #2
Use Path.Combine and AppDomain.BaseDirectory.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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.

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Glenn | last post by:
Hi, I have a config XML file that I am using from the application cache. I have configured the entry with a remove callback to re-populate cache automatically when the XML file changes. All is...
7
by: moondaddy | last post by:
I want to dynamically create a JavaScript file and cache it on the client for re-use. I know how to write javascript to a web page from the code behind, but I don't know how to actually create a...
9
by: darrel | last post by:
I'm accessing an XML file several times on a page, and, as such, want to cache it. I'm setting it up as such: if cache("xmlFile") is nothing then... load file cache file else read it
1
by: Bishop | last post by:
I have googled to try and find an answer to this issue, but everything I found beats around the bush. I have a web service that calls a DLL. In the DLL, I want to cache the small table data...
1
by: Jose Fernandez | last post by:
Hello First of all, sorry for my bad english ;) I have a USER class that i create to every user that enters the website (not neccesarily logged in). At the same time i insert it into a the...
5
by: | last post by:
Is it advisable to store my own data as XML in the folder returned by HttpRuntime.CodeGenDir? (i.e. in "Temporary ASP.NET Files") Each web service on the server must try to read its own cached...
5
by: BLUE | last post by:
I insert a string in cache in a property set and I retrieve that string in the get. I retrieve my string with Read web method and I insert it with Write web method: to try cache I do Read,...
6
by: =?Utf-8?B?emlubw==?= | last post by:
in asp.net 2, I load a dataset from the Cache object into a local object to use to perform processing. I had been using httpcontext.current.cache and what I noticed is sometime I'm not able to get...
7
by: Andrew Jocelyn | last post by:
Hi I'm running an ASP.NET web application under IIS. I'm inserting a cache object with a file based CacheDependency. I've noticed that when the file changes the Cache object is not always...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.