ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 11th, 2003, 01:16 PM
WebCityTech WebCityTech is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Hudson County- NJ
Posts: 3 WebCityTech User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ASP and sessions

Hello ALL,

I am wondering if someone can help me out regarding ASP pages using sessions and my MS SQL 2000 for my login record. If a user visits a page in my site that is part of the set of screens that appear after the login is accepted- I want to avoid unauthrorized users from visiting those pages if they don't have a session with their logon. If they don't have a session, they get re-directed to my home page.. I NEED security!
Some smart users or hackers can type the URL directly and I need them to stay out- get bumped!


Thanks.

Reply With Quote
  #2  
Old June 11th, 2003, 04:20 PM
mudhoney609 mudhoney609 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 1 mudhoney609 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Simply use response.redirect to redirect users that don't have the "logged in" session variable.

When a user logs in after authenticating by supplying a username and password stored in the database, set a session variable that holds a value. For example, you could store thier username in a session variable called "username".

<%
...
...
If NOT rs.EOF OR NOT rs.BOF Then
'This is a valid user
Session("username") = rs.Fields.Item("username").Value
Else
'Invaild username
Response.Redirect("homepage.asp")
End If
...
...
%>

Now you have a session variable that can tell you whether or not the user is logged in, and you can check for the existence of this session on any pages that need protection.

The best way to accomplish this is to include a snippet similar to the following on every page that you would like to protect:

<%
If Session("username") = "" Then
Response.Redirect("homepage.asp")
End If
%>

You could optionally place this snippet in an include file ("inc_security.asp") and include it on any page that requires it.

Reply With Quote
  #3  
Old June 14th, 2003, 02:02 AM
brainmaster brainmaster is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 7 brainmaster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
plz contact me at my email i will send u
code


Brainmaster2010@hotmail.com

bye n take care

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > ASP and sessions


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT