?
Solved

ASP / ASP.Net Session Variables

Posted on 2012-04-07
4
Medium Priority
?
500 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1600 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 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