Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting asp.net session data from asp - vbscript

Status
Not open for further replies.

GuyC

Programmer
Oct 8, 2002
5
US
Hey Folks,
I have an asp application, to which I am introducing some asp.net pages. The bulk of my app is asp and there is a bunch of session data that my new asp.net pages will need to know.
I would like to make a call to an asp.net sub that sets the session data in the .net session everytime I set session data in asp


Example:
'asp code
'set user session data
session("UserID") = oRS("UserID")
session("UserLast") = oRS("UserLast")
session("UserFirst") = oRS("UserFirst")
'Pass these values to asp.net
SetSession("UserID",session("UserID"))
SetSession("UserLast",session("UserLast"))
SetSession("UserFirst",session("UserFirst"))


'asp.net code
Sub SetSession(ByVal pSessionName as String, ByVal pSessionValue as String)
Session(pSessionName)=pSessionValue
End Sub


the problem is that I am not sure how/if I can make the call to the asp.net sub from the asp code

...
SetSession("UserID",session("UserID"))
...


Thanks
 
You can't transfer it directly like that. The only way to transfer that data is to send the info via querystring to an aspx page, and then stuff it into asp.net session. There has been much discussion over this very issue, and it will make integrating an asp site that makes use of session more difficult.

Session has been changed greatly (i.e. improved) and so they just can't talk to each other directly. Two totally different animals.

:-(
penny1.gif
penny1.gif
 
passing session data via querystring sounds a bit kludgy
it could also create a security hole, if the session data is sensative.

among other things, I use session variable to store the user's security settings
i.e.
session("ReadOverviewPage") '...should the user be here?
session("EditOverviewPage") '...edit mode or read only?

since I am re-writing certain pages in asp.net, the new asp.net versions of this page will need to know the values of these session varialbes

if I pass them in via querystring, then the user could intercept/alter the values and re-display the page with the new values

hmmm... this may be stickier than I hoped


 
is there a way to launch a querystring to an asp.net page without exiting the current page being processed?
(i.e. without a redirect)

then that asp.net page could receive the session data via querystring, set the asp.net session data from those values and then do a response.end. This way the data would be set, but the querystring and asp.net page that sets the sessin data would never be realized by the client.

this whole thing would be a seperate thread/process from the page that initiated it. the asp page that initiates it must be able to continue.

I hope I am making sense here...
 
You might also look at writing them to a database and then reading them by your next page. You can encrypt them for security.
 
Depending on the network traffic, I would lean towards cjlarue's solution if security was an issue.

Querystring kludgy? Eh... depends, really. I have some pretty clean implementations of this method in sites I'm not worried about security on.

:)
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top