ASP Session Vars to ASP.Net

J

JDP@Work

First off let me say that

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/converttoaspnet.asp

would not work as I see it. Right off, I can't have a cookie.

Anyway, another solution suggests using hidden form fields only helps me to know
that there is a way, I don't know how to pass a hidden form field from my clasic
ASP to ASP.Net

So does anyone have a down and dirty example of ASP passing its session to an
ASPX page using any reliable method other than cookies?

My ultimate goal....

.....is to use SQLRS and to do so, I expect to have to lauch from .Net.

This is an intranet so there is little security, however when my users enter
their login on the default.asp and logs in, querys are run that retrieve the
appropriate security information and stores them in the ASP seesion vars,
loading them from page to page into hidden form fields.

Many of the ASP pages are called and if the session vars are populated
automatically call the subsequent pages, depending on security depositing the
user at the appropriate page or Crystal report rendered.

TIA

JeffP...
 
S

Steve C. Orr [MVP, MCSD]

There is no single great way to share session state between ASP and ASP.NET.
But that doesn't mean you don't have options.

Here are some common ways:
* Store the data in a common database
* Pass data from page to page on the QueryString
* Store the data in cookies
* Use a 3rd party session sharing component
(Here's one:
http://www.consonica.com/solutions/dotnet/statestitch/index.html)
* Use COM Interop to provide an object that both sides can access that
handles the data.
Here's an example of the latter:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ConvertToASPNET.asp
 
J

JDP@Work

Lucas, I don't need to go bi-directional, and I knew that I could use MSSQL to
store all my session NV's, its just a bunch of network round-trips on an already
overloaded network.

Further we're getting heat from the official IT Dev Dept and they want Alpha,
Beta and Load testing data prior to going live, egads, I'm trying to have a
light footprint. The only thing saving us right now is that ITDev isn't
compliant with their own standards so we've got a little le-way.

How'a bout this little diddy?

I think this loaded using the Form or QueryString. Perhaps someone could shed
some more light here.

ASPTransfer.aspx

....generic script omitted...
<%
' Copy all Session variables from the Request beginning with "S" (From ASP)
into
' our .NET session.
' Copy all request variables into .NET Request variables for our next post.
Dim itemSession as Object
Dim i as Integer = 1
Dim iCount as Integer = Request.Form.Count - 1
For i = 0 to iCount
if Left(Request.Form.GetKey(i),1) = "S" then
Session.Contents.Add(Request.Form.GetKey(i), Request.Form(i))
Response.Write(Session.Contents.Count & "<BR>" & vbCRLF)
else
Response.Write("<input type=hidden name=" & Mid(Request.Form.GetKey(i),2) &
_
" value=" & Request.Form(i) & ">")
end if
Next
%>
.... script truncated....

TIA


JeffP....
 
L

Lucas Tam

I think this loaded using the Form or QueryString. Perhaps someone
could shed some more light here.

ASPTransfer.aspx

...generic script omitted...
<%
' Copy all Session variables from the Request beginning with "S"
(From ASP)
into
' our .NET session.
' Copy all request variables into .NET Request variables for our
next post. Dim itemSession as Object
Dim i as Integer = 1

Did the script you write work?

I think it would be better if you had two pages.

Page 1 - ASP - Copy stuff to Form Variable
Page 2 - ASP.NET - Copy Form Variable to Session

You maybe able to save a redirect by using Server.Transfer on Page 1.
Not sure if you Server Transfer from ASP to ASP.NET tho.
 
R

Rutger Smit

JDP@Work said:
Anyway, another solution suggests using hidden form fields only helps me to know
that there is a way, I don't know how to pass a hidden form field from my clasic
ASP to ASP.Net

Well, maybe not so neat but it could be a 'solution':
Dump all your data in hidden fields with a <form> tag that has it's
action property set to a aspx page. In that aspx page you can use
Request.Form to retrieve the values.

//Rutger
 
J

JDP@Work

Lucas, Did it work? Kinda, I'm still getting unknown errors launching my working
Crystal report, so I know something is wrong, debugging by writing my params is
still in process.

I think that the form fields may be the way to go as Rutger has suggested, but I
have little confidence because non of the other sites and MSDN suggest this
method.

TIA

JeffP....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top