ASP Session Vars to ASP.Net

Discussion in 'ASP .Net' started by JDP@Work, Aug 27, 2004.

  1. JDP@Work

    JDP@Work Guest

    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...
     
    JDP@Work, Aug 27, 2004
    #1
    1. Advertising

  2. 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

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net


    "JDP@Work" <> wrote in message
    news:eD7%23%...
    > 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...
    >
    >
     
    Steve C. Orr [MVP, MCSD], Aug 27, 2004
    #2
    1. Advertising

  3. JDP@Work

    Lucas Tam Guest

    Lucas Tam, Aug 27, 2004
    #3
  4. JDP@Work

    JDP@Work Guest

    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....



    "Lucas Tam" <> wrote in message
    news:Xns955236501018nntprogerscom@140.99.99.130...
    > "JDP@Work" <> wrote in
    > news:eD7##:
    >
    > > 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?

    >
    > Here's what I use:
    >
    > http://www.asp101.com/articles/sidney/sharingsessionstate/default.asp
    >
    >
    > --
    > Lucas Tam ()
    > Please delete "REMOVE" from the e-mail address when replying.
    > http://members.ebay.com/aboutme/coolspot18/
     
    JDP@Work, Aug 27, 2004
    #4
  5. JDP@Work

    Lucas Tam Guest

    "JDP@Work" <> wrote in
    news:ea0UrG$:

    > 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.

    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.
    http://members.ebay.com/aboutme/coolspot18/
     
    Lucas Tam, Aug 27, 2004
    #5
  6. JDP@Work

    Rutger Smit Guest

    JDP@Work wrote:

    >
    > 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
     
    Rutger Smit, Aug 27, 2004
    #6
  7. JDP@Work

    JDP@Work Guest

    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....

    "Rutger Smit" <> wrote in message
    news:...
    > JDP@Work wrote:
    >
    > >
    > > 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
    >
    >
     
    JDP@Work, Aug 27, 2004
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bill Dodd
    Replies:
    4
    Views:
    344
    Bill Dodd
    Nov 13, 2003
  2. Jon

    app vars and cache vars

    Jon, Dec 14, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    409
  3. Linuxguy123
    Replies:
    7
    Views:
    712
    Paddy O'Loughlin
    Feb 20, 2009
  4. caccolangrifata
    Replies:
    18
    Views:
    410
    Chris Torek
    Jul 22, 2011
  5. wozza

    Using cookies & session vars in asp

    wozza, Feb 10, 2004, in forum: ASP General
    Replies:
    2
    Views:
    113
    Ray at
    Feb 10, 2004
Loading...

Share This Page