473,378 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

sessions in asp

hi,

At present am doing one website project. In this project i have to secure my website on that session only......If the user copy and paste the url of intermediate pages of my website to another browser page means it wont be display......
how can i write the coding???? please suggest me........Thank You...
Jul 21 '06 #1
6 2078
cbrao
3
Have an include file at top of all files. Check for logged user ID in session variable and if not available, redirect him to login page.
Jul 22 '06 #2
sashi
1,754 Expert 1GB
Hi Mubarak,

please refer to below sample.. hope it helps.. good luck my fren..

under your login function.. if the user is validated and has access to your application set the session to yes..
Expand|Select|Wrap|Line Numbers
  1. <%
  2.    Session("isLoggedIn")   = "yes"
  3. %>
  4.  
on the page that you wish to protect..
Expand|Select|Wrap|Line Numbers
  1. <%
  2.   If Session("isLoggedIn") <> "yes" Then
  3.     Response.Redirect "access_denied.asp"
  4.   End If
  5. %>
  6.  
Jul 22 '06 #3
danp129
323 Expert 256MB
If you also want to add a little bit of protection against session hijacking, change sashi's code to:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Session("isLoggedIn")   = "yes"
  3. Session("security") = Request.ServerVariables("REMOTE_ADDR") & " " & _
  4.   Request.ServerVariables("HTTP_USER_AGENT")
  5. %>
  6.  
And this to the top of each page you want to protect:

Expand|Select|Wrap|Line Numbers
  1. <%
  2.   If (Session("isLoggedIn") <> "yes") or _
  3.         (session("security") <> Request.ServerVariables("REMOTE_ADDR") & " " & _
  4.         Request.ServerVariables("HTTP_USER_AGENT")) Then
  5.     Response.Redirect "access_denied.asp"
  6.   End If
  7. %>
  8.  
This will verify that their IP didn't change and are using same browser as the person that logged into that session.
Jul 28 '06 #4
sashi
1,754 Expert 1GB
hi Dan,

thanks for the idea and info.. take care my fren.. :)
Jul 30 '06 #5
Hi Guys

Im currently working on a project which shows the result coming from another server. Our server is hosting the html web form in aspx page and when user submitting the form it goes directly to another server having the same form selecting the same form values thyr, appending with URL by get method. The only prob im facing is to get session id of remote form. Like we have a link to that form which is "http://www.watever.com/form.aspx". I need to get the session id of this form to append to its URL which is "http://www.watever.com/form.aspx?no_hot=marriot&host=me&sid="

I need to get sid value to append to the above URL. Any help or sample piece of code wud be great.

Best Regards
Shaukat Waqar
Aug 5 '06 #6
sashi
1,754 Expert 1GB
Hi Shaukat,

well.. i suggest using quesrystring method.. since [sid] is passed on as a querystring you can capture the value stored in [sid] with request querystring method.. see below sample code segment..

Expand|Select|Wrap|Line Numbers
  1.   Dim nSid
  2.  
  3.     nSid = Request.QueryString("sid") 
  4.  
Aug 5 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: The Plankmeister | last post by:
Hi... I'm trying my hardest to understand fully how sessions work and how best to use them. However, all I can find is information that doesn't tell me anything other than that sessions store...
13
by: jing_li | last post by:
Hi, you all, I am a newbee for php and I need your help. One of my coworker and I are both developing a webpage for our project using php. We have a copy of the same files in different location...
3
by: Maxime Ducharme | last post by:
Hi group We have a problem with sessions in one of our sites. Sessions are used to store login info & some other infos (no objects are stored in sessions). We are using Windows 2000 Server...
3
by: Will Woodhull | last post by:
Hi, I'm new here-- I've been reading the group for a couple of days. Nice group; I like the way n00b33 questions are handled. I've been using a Javascript routine in index.html to determine a...
2
by: Steve Franks | last post by:
According to the docs you tell ASP.NET to use cookieless sessions by setting a value in the config.web file. However, what if I wanted to determine at run time whether or not I wanted to use...
12
by: D. Shane Fowlkes | last post by:
This is a repost (pasted below). Since my original post, I've double checked the system clock and set all IIS Session Timeout values to 10 minutes. Still ...the problem occurs. I've also...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
22
by: magic_hat60622 | last post by:
Hi all. I've got an app that dumps a user id into a session after successful login. the login page is http://www.mydomain.com/login.php. If the user visits pages on my site without the www (i.e.,...
13
Frinavale
by: Frinavale | last post by:
One of the most fundamental topics in web design is understanding how to pass information collected on one web page to another web page. There are many different ways you could do this: Cookies,...
3
Atli
by: Atli | last post by:
Introduction: Sessions are one of the simplest and more powerful tools in a web developers arsenal. This tool is invaluable in dynamic web page development and it is one of those things every...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.