Posted 12 Aug 2005
Link to this post
We have a problem with asp.net's Server.MapPath() function. It's not a
problem of any telerik product, but it prevents us from using the
RadEditor since the Image Manager uses this function. Forgive me if
this doesn't belong here, but after days of debugging and
trial&error we are quite desperate - maybe there are some people
among you who can point us in the right direction.
Filesystem structure is as follows:
We have a web (on IIS6) with multiple host headers configured, let's
say "www.site1.com" and "www.site2.com". The web's home directory is
d:\inetpub\wwwroot\website. The web runs an ISAPI filter .dll that does
- It looks in the current url for "/images/";
- When "/images/" is found, it uses the current host header / server
name to rewrite the url path to a corresponding fileserver directory.
So, for example:
- When www.site1.com/images/foo.jpg is requested, the ISAPI makes IIS look for "foo.jpg" in d:\fileserver\1\images;
- When www.site2.com/images/bar.jpg is requested, the ISAPI makes IIS look for "bar.jpg" in d:\fileserver\2\images.
This works fine, not a problem. Now, let's say you place a file
"test.aspx" + codebehind file in the website's root and you put the
following code in it:
Untill a couple of days ago, this returned the correct translated path.
If you requested www.site1.com/test.aspx, it returned
d:\fileserver\1\images. If you requested www.site2.com/test.aspx, it
returned d:\fileserver\2\images. Now, the problem that's suddenly come
It seems that suddenly ASP.NET holds the translated path in its memory
for all subsequent requests. If you now request
www.site1.com/test.aspx, it returns d:\fileserver\1\images. And it
keeps returning this, even if you request www.site2.com/test.aspx. So,
ASP.NET caches the path that Server.MapPath returns. We know it's a
caching issue, cause after an IIS restart or an application build, the
cache is emptied and the correct path is returned. But then it is
cached again and the problem starts all over again. We also know it's a
.NET issue, cause when you create a test.asp file (that is processed
by the classic ASP engine), it returns the
correct path - every time!
So, my questions are obvious.
- Why did ASP.NET start caching this path suddenly?
- How to solve this?
- I have searched the web for answers, but I can't find anything about
.NET's internal caching. Is there any way to influence it?
Sorry this is such a long story, I wanted to make the situation
absolutely clear. I think this is a real expert question, I hope
someone has an idea of where to look. My thanks in advance.