|
 |
asp_databases thread: sessions
Message #1 by "Brad" <insuran@m...> on Thu, 25 May 2000 1:41:32
|
|
I am creating a webpage that requires a user to log in. Once the user has
logged in, a session containing the user's info is created. I want to have
some code that will check to make sure the user has logged in properly to
avoid people bookmarking and not logging in..
I am not sure how to do this
If session does not exist then
Response.write "Please Log in first"
else
Load the page....
end if
Can you help me out? Thanks Brad
Message #2 by Mark Everest <Mark.Everest@t...> on Thu, 25 May 2000 12:24:09 +0100
|
|
Probably the simplest way is to put a variable in the session to check on
each page.
i.e.
login page does...
session("LoggedIn") = true
other pages do .....
if not session("LoggedIn") then
blah blah blah
end if
-----Original Message-----
From: Brad []
Sent: 25 May 2000 02:42
To: ASP Databases
Subject: [asp_databases] sessions
I am creating a webpage that requires a user to log in. Once the user has
logged in, a session containing the user's info is created. I want to have
some code that will check to make sure the user has logged in properly to
avoid people bookmarking and not logging in..
I am not sure how to do this
If session does not exist then
Response.write "Please Log in first"
else
Load the page....
end if
Can you help me out? Thanks Brad
Message #3 by "Kenneth Carlsson" <dp100kennethc@l...> on Thu, 25 May 2000 13:31:08 +0200
|
|
Put this at the end of the page where you checkup on theire access...
Session("access_id") = rs("access_id") 'from the database
then on the page where you want to check if they have any "access_id" just
do like this.
<%
if Session("access_id") = "" then
response.write ("You didnt logon correctly!!!")
else
load page here....
end if
%>
Ken
----- Original Message -----
From: "Brad"
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, May 25, 2000 1:41 AM
Subject: [asp_databases] sessions
> I am creating a webpage that requires a user to log in. Once the user has
> logged in, a session containing the user's info is created. I want to have
> some code that will check to make sure the user has logged in properly to
> avoid people bookmarking and not logging in..
> I am not sure how to do this
>
> If session does not exist then
> Response.write "Please Log in first"
> else
> Load the page....
> end if
>
> Can you help me out? Thanks Brad
>
Message #4 by =?iso-8859-1?Q?Gonzalo_Ruiz_de_Villa_Su=E1rez?= <gonzalo.ruizdevilla@a...> on Thu, 25 May 2000 14:05:32 +0200
|
|
Try using a session variable and redirecting when the user has not logged
in.
Remember not to write any html code before redirecting.
<%
If Session("LoggedIn") = TRUE Then
Response.Redirect ("errorlog.asp")
Else
%>
<html>
your page here....
</html>
<%
End If
%>
Gonzalo Ruiz de Villa
-----Mensaje original-----
De: Brad
Enviado el: jueves, 25 de mayo de 2000 1:42
Para: ASP Databases
Asunto: [asp_databases] sessions
I am creating a webpage that requires a user to log in. Once the user has
logged in, a session containing the user's info is created. I want to have
some code that will check to make sure the user has logged in properly to
avoid people bookmarking and not logging in..
I am not sure how to do this
If session does not exist then
Response.write "Please Log in first"
else
Load the page....
end if
Can you help me out? Thanks Brad
Message #5 by "Abhijit Natu" <natuu@h...> on Thu, 25 May 2000 18:09:35 +0530
|
|
Hi Brad,
You can create probably a session ("user")=user collection. user collection
has all attributes related to the user.e.g;
user("id")=1
user("fname")="kam"
etc.....
Also u can set cookies whenever user logs in. That wiill be helpful in all
subsequent pages for getting loginid.
Abhjit
----- Original Message -----
From: Brad <>
To: ASP Databases <asp_databases@p...>
Sent: Thursday, May 25, 2000 1:41 AM
Subject: [asp_databases] sessions
> I am creating a webpage that requires a user to log in. Once the user has
> logged in, a session containing the user's info is created. I want to have
> some code that will check to make sure the user has logged in properly to
> avoid people bookmarking and not logging in..
> I am not sure how to do this
>
> If session does not exist then
> Response.write "Please Log in first"
> else
> Load the page....
> end if
>
> Can you help me out? Thanks Brad
Message #6 by "Ruth Nisenbaum" <ruth@z...> on Thu, 25 May 2000 15:18:31 +0200
|
|
In global.asa, I defined a session variable called user so I check if it is
set.
At the top of every page, I check if the person logged in:
<%
if session("User")="" then
response.redirect "login.asp"
end if
Response.Expires = 0
%>
Where the user logs in, if it is a recognized user, I use:
session("User")=cCustomer
In global.asa
Sub Session_OnStart
Session("User")=""
Session.Timeout = 30
End Sub
Sub Session_OnEnd
Session("User")=""
End Sub
Hope it helps,
Ruth
----- Original Message -----
From: "Brad"
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, May 25, 2000 1:41 AM
Subject: [asp_databases] sessions
> I am creating a webpage that requires a user to log in. Once the user has
> logged in, a session containing the user's info is created. I want to have
> some code that will check to make sure the user has logged in properly to
> avoid people bookmarking and not logging in..
> I am not sure how to do this
>
> If session does not exist then
> Response.write "Please Log in first"
> else
> Load the page....
> end if
>
> Can you help me out? Thanks Brad
>
|
|
 |