Master pages and Redirects & paths?

R

Rob R. Ainscough

I'm using a single Master page.

I'm having some strange results using Redirects in master pages using
relative pathing i.e ~. I'm using Form authentication and whenever I
navigate to my Login form (under a different dir called Secure) and then
navigate back to my main form under root dir and then try to navigate to
another form at the root dir level, it will look for the aspx page under the
"Secure" dir rather than my root dir??

example (navigation route):
MyWeb/Main.aspx --> ~/Secure/Login.aspx --> MyWeb/Main.aspx -->
MyWeb/PrivaceyPolicy.aspx

what actually happens
MyWeb/Main.aspx --> ~/Secure/Login.aspx --> MyWeb/Main.aspx -->
MyWeb/Secure/PrivaceyPolicy.aspx

As soon as I navigate to my /Secure/Login.aspx all my pathing in redirects
seem to get the dir "Secure" injected into the path?? I've tried using ~/
but that results in MyWeb/~/PrivaceyPolicy.aspx.

Any suggestions?

Rob.
 
R

Rob R. Ainscough

Thank you, got it working.

Brock Allen said:
Anytime you reference external URLs/links/resources form the master, you
need to keep in mind that the reference is relative to the page being
requisted, not relative to the location of the .master itself. So the
typical solution to this is to always use app-relative references using
the ~/path syntax, where "~" is magic for "the root of my application" and
then you reference the resource you need from the top down.
 

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,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top