Solved

ASP / ASP.Net Session Variables

Posted on 2012-04-07
4
490 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How do I get the id from URL? 19 47
Server error in 'XXXXXXXX' application. 12 49
asp syntax 3 23
Asp.net mvc 5 5 17
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 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

20 Experts available now in Live!

Get 1:1 Help Now