I know the following is a bit long, and probably not the best way to do
things (probably even a little confusing) but, it should give you a basic
idea.
'Set a session variable when they log in, such as;
If Session("Logged") = True Then
'grant them access
Else
'kick them to google or something
End If
'Then to access the actual file........ first check to make sure they
are logged in.
If AreTheyLoggedIn = True Then
Dim strPath
'URL is the server path to the file (see below)
strPath = StripAbsPath(URL) & "\myfile.txt"
Response.Redirect strPath
Else
Response.Redirect "not-logged_in.asp"
End If
'Here, we set strPath as the main path, then use request.servervariables
to get the server name, and finally,
' I've written a custom function to convert an absolute path (server
path) to a URL which you can use.
'
' fl.path is the file path (gotten via FSO), Replace has been used
aswell, to convert \ (server) to / (URL)
strPath = "http://" & request.servervariables("SERVER_NAME") &
replace(StripABSPath(fl.Path), "\", "/")
' Note: StripABSPath will ONLY accept an absolute path, it will not
accept a URL. (atleast, not if you want
' strPath to work anyway).
Function StripABSPath(name)
Dim path
path = Split(name, "private") 'Just above the root or "main"
folder
StripABSPath = path(UBound(path))
End Function
'Just double checks to make sure they're logged in
Public Function AreTheyLoggedIn()
If Session("Logged") = True Then
AreTheyLoggedIn = True
Else
AreTheyLoggedIn = False
End If
End Function
--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Mark <an*******@devdex.com> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
Sorry - I'm not getting this.
If I do not allow anonymous access, and the site is on an internet,
where it is not possible to setup windows authentication, then how do I
capture the fact that a user has logged in (using a database lookup -
setting a session variable to say they are allowed access) when the
system redirects them to the http://www.mysite/files/myfile.txt dir/file
- if anonymous access is not allowed on this directory, they will be
prompted for a user name, password and domain.
Can I capture the event at this point, to say 'this person has already
logged in, and has a session variable set - so do not show the
username/password/domain box - let them view the file'?
Thanks again for the help,
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!