Server.Transfer Virtual Directory Problems

W

Webmills

Has anyone come across the problem that I am experiencing?

I have a master page using four or five Hyperlink controls, each with
an ImageUrl. The ImageUrl is specified using a virtual directory path,
such as ImageUrl = "~/Images/Main.gif".

I have a child page in a sub directory, images all appear to be
correct. However, if I use a Server.Transfer to transfer to a different
child page in a different sub directory or at the root level, the
ImageUrl path does not update correctly. The hyperlink ImageUrl points
to an invalid directory. However the hyperlink NavigateUrl is always
correct, even though this also makes use of a virtual directory path.

To get the graphics to work again I need to physically refresh the page
with the F5 key.

Sound like an ASP.NET bug?

If I use a Response.Redirect rather than a Server.Transfer then it all
works as expected.

James
 
F

Flinky Wisty Pomm

I don't think it's a bug - the problem you're having is easily
explained if you look at the difference between Server.Transfer (use
current request state on a different page) and Response.Redirect(send a
new request to somewhere else)

Because the transferred request has the original URL, it's mapping your
directories wrongly.

http://www.developer.com/net/asp/article.php/3299641
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top