Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


preventing unauthorized access

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,2616
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> preventing unauthorized access
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 preventing unauthorized access - 4/7/2005 8:52:32 PM   
  lessonsd

 

Posts: 2
Score: 0
Joined: 4/7/2005
From:
Status: offline
To prevent unauthorized access to my website, i inserted the following script at the beginning of my asp files:

<%
If Session("LoginUser") = "" Then
Response.Redirect "index.htm"
End if
%>

the LoginUser happens when the authorized user successfully first enters their user id & password (stored in an ACCESS database). if the valid user id is not entered, it redirects to index.htm. this could happen when the unauthorized user simply puts the page address in their browser trying to go around the system.

the problem i am having is that this simple code works fine, but after some time the server seems to "forget" the valid LoginUser, and when the page is refreshed the valid user is redirected to index.htm.

can anyone think of a better way of either changing the above script or using different script to prevent unauthorized website access?

thank you
 
 
Post #: 1
 
 Re: preventing unauthorized access - 4/9/2005 10:04:34 AM   
  VBS

 

Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status: offline
Dear lessonsd,
Your code is fine but u must give the session a time out time using this code:


      

and the 60 means 60 minutes

so the server will not forget the session until 60 or other time u setup

Hope this helps

Best Regrads
Firas S Assaad

(in reply to lessonsd)
 
 
Post #: 2
 
 Re: preventing unauthorized access - 4/13/2005 6:52:31 PM   
  awieds

 

Posts: 2
Score: 0
Joined: 4/13/2005
From:
Status: offline
lessonsd,
I also need to create a password protected page. (I also intened on keeping the logon id's and password in Access). How do you create the page?

Thanks

(in reply to lessonsd)
 
 
Post #: 3
 
 Re: preventing unauthorized access - 4/14/2005 3:26:34 AM   
  VBS

 

Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status: offline
Dear awieds,
I could tell u how after lessonsd,

To do that:

1. after checking whether the UID and the PWD exist in the database or not

2. if yes then put these two lines:

      

3. in the default.asp (for example) put these few lines of code:

      

In conclusion, using sessions is like using a global variable that could be used anywhere in the site, and every session is diffrent from every user. For example if user1 had logged in then his session("Loged") will contain the data "yes" but if user2 hasn't loged in (visitor) the his session("Loged") will be empty, even if both of the users are online in the same time, but on diffrent PCs.

Hope this helps


Best Regards

Firas S Assaad

(in reply to lessonsd)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> preventing unauthorized access Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts