Solved

ASP / ASP.Net Session Variables

Posted on 2012-04-07
4
491 Views
Last Modified: 2012-04-08
Hi,

I have some session variables in ASP that I would like to convert to ASP.NET session variables so that I can use them on the .net pages

there are 2 possiblilites I could use

Sessionstate.asp
contains a form with the following textfields:
username
company

this then gets redirected to sessionstate.aspx

set the ASP.Net session states
username = request.form("username")
company= request.form("company")


or

sessionstate.aspx convert the session variables

is this possible?

Thanks for any help
0
Comment
Question by:sanjshah12
  • 2
  • 2
4 Comments
 
LVL 18

Expert Comment

by:Jerry Miller
ID: 37820048
You can set or change the session variables on any page that you like. You won't have to create a separate page and redirect to it.

Session("username") =  usernameTextbox..Text
Session("company") = companyTextBox.Text

http://msdn.microsoft.com/en-us/library/ms178581.aspx
0
 

Author Comment

by:sanjshah12
ID: 37820120
Apologies for not being very clear, the user in this case is logged in from an ASP page but ASP.Net pages do not recognise asp variables thus I have created the redirect pages from an ASP to ASPX page.
0
 
LVL 18

Accepted Solution

by:
Jerry Miller earned 400 total points
ID: 37820157
Then when you redirect it to sessionstate.aspx set the variables this way:

Session("username") =  request.form("username")
Session("company") = request.form("company")

Read this quick article about session best practices, it can help guide you a bit.

http://www.aspnet101.com/2010/10/asp-net-session-state-best-practices/
0
 

Author Closing Comment

by:sanjshah12
ID: 37821406
Thanks that works great!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need to pass a connection through class/Method 1 39
Name space syntax error 12 43
ASP.net Javascript use multiple sliders 2 19
Need a starter for ETL protocol? 4 42
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now