Simple Question regarding relative path references

D

damiensawyer

Hi all,

I hope that this question isn't too simple...

I am storing all of my webforms in a /forms directory (with the
exception of Default.aspx). I have created the following code in
Global.asax which is supposed to forward people to the login page if
they make a request (for any page) without an active session.

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
If InStr(Request.Path.ToLower, "login.aspx") = 0 Then
Response.Redirect("forms/login.aspx")
End If
End Sub

The problem is, It appears to be adding the url to the end of the
current path. So, if they were in a form in the forms directory which
has 'expired', the redirection is attempted againts

http://localhost/myapp/forms/forms/login.aspx

I've tried "./../forms/logix.aspx" however to no avail... because files
are not 'always' called from the forms directory (eg, default.aspx)

Can someone please point out to me what I'm doing wrong?


Thanks in advance,



Damien Sawyer
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top