Problems with Server.Mappath after Error handled in Global.asax (not the missing ~-problem!)

M

Michael

Hi

I have a problem related to global.asax and the Server.Mappath-Method.

I collect all unhandled errors in the Application_Error in
Global.asax.
According to the type of error I redirect/transfer the user to the
correct error page.

DataException --> ~/DBError.aspx
HttpException --> ~/XyxError.aspx

This works fine for the redirect or transfer. But INSIDE the loaded
error page my ~/Xyz.gif or ~/Xyz.aspx are mapped wrong (including the
subfolder), if the originally error happend in a subfolder of the main
app.

http://www.myurl.com/PageThatRaisedTheError.aspx --> everything is ok
http://www.myurl.com/SubFolder/PageThatRaisedTheError.aspx -->
Error.aspx is loaded, but every link inside Error.aspx starting with
~/ is resolved as http://www.myurl.com/SubFolder/ instead of http://
www.myurl.com/

It looks like that my base directory change to the subfolder, so that
Mappath interprets the subdirectoy as application base.

On my development machine (development server, latest Patches for VS
2005 installed) everything works fine, but on my hosting machine (IIS)
the problem appears.

Has someone any idea or solution? My search on the forums didn't
helped me ... maybe you?

Thanks
Michael
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top