Passing Session Variables from ASPX to ASP application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • GeRmIc

    #1

    Passing Session Variables from ASPX to ASP application

    Hi,

    I have an ASPX application from which I need to pass session variables
    (ex:username and password) to an ASP Page. How do I do this? Could you pls
    give a n example code for both aspx and asp.

    Thanks!

  • Peter Bromberg [C# MVP]

    #2
    RE: Passing Session Variables from ASPX to ASP application

    GeRmIc,
    Here is one way:



    Peter
    --
    Co-founder, Eggheadcafe.com developer portal:

    UnBlog:





    "GeRmIc" wrote:
    [color=blue]
    > Hi,
    >
    > I have an ASPX application from which I need to pass session variables
    > (ex:username and password) to an ASP Page. How do I do this? Could you pls
    > give a n example code for both aspx and asp.
    >
    > Thanks!
    >[/color]

    Comment

    • GeRmIc

      #3
      RE: Passing Session Variables from ASPX to ASP application

      Thanks Peter. How do I do it the other way? Passing passwords from an ASPX
      page to classic ASP page.

      Thanks again!

      "Peter Bromberg [C# MVP]" wrote:
      [color=blue]
      > GeRmIc,
      > Here is one way:
      >
      > http://www.eggheadcafe.com/articles/20021207.asp
      >
      > Peter
      > --
      > Co-founder, Eggheadcafe.com developer portal:
      > http://www.eggheadcafe.com
      > UnBlog:
      > http://petesbloggerama.blogspot.com
      >
      >
      >
      >
      > "GeRmIc" wrote:
      >[color=green]
      > > Hi,
      > >
      > > I have an ASPX application from which I need to pass session variables
      > > (ex:username and password) to an ASP Page. How do I do this? Could you pls
      > > give a n example code for both aspx and asp.
      > >
      > > Thanks!
      > >[/color][/color]

      Comment

      • Peter Bromberg [C# MVP]

        #4
        RE: Passing Session Variables from ASPX to ASP application

        geRmic,
        go back and read the article again. The download includes code in both C#
        and VB.NET to pass session variables in both directions.
        Peter.
        --
        Co-founder, Eggheadcafe.com developer portal:

        UnBlog:





        "GeRmIc" wrote:
        [color=blue]
        > Thanks Peter. How do I do it the other way? Passing passwords from an ASPX
        > page to classic ASP page.
        >
        > Thanks again!
        >
        > "Peter Bromberg [C# MVP]" wrote:
        >[color=green]
        > > GeRmIc,
        > > Here is one way:
        > >
        > > http://www.eggheadcafe.com/articles/20021207.asp
        > >
        > > Peter
        > > --
        > > Co-founder, Eggheadcafe.com developer portal:
        > > http://www.eggheadcafe.com
        > > UnBlog:
        > > http://petesbloggerama.blogspot.com
        > >
        > >
        > >
        > >
        > > "GeRmIc" wrote:
        > >[color=darkred]
        > > > Hi,
        > > >
        > > > I have an ASPX application from which I need to pass session variables
        > > > (ex:username and password) to an ASP Page. How do I do this? Could you pls
        > > > give a n example code for both aspx and asp.
        > > >
        > > > Thanks!
        > > >[/color][/color][/color]

        Comment

        • GeRmIc

          #5
          RE: Passing Session Variables from ASPX to ASP application

          Hi Peter,

          I'm still facing some problems with ASPX to ASP password passing. Could you
          pls help....

          In ASPX page
          --------------
          <%
          String nameaspx = (String) Session["UserName"];
          Session["nameasp"] = nameaspx; %>

          So, I am passing nameasp to the asp page which is called by a hyperlink and
          not a submit/post.

          Now, how do i retreive nameasp in the asp page?

          Thanks a ton!!

          Comment

          • GeRmIc

            #6
            Passing Session Variables from ASPX to ASP application

            Example files
            ==========
            finance2.aspx
            ---------------
            <% Session["uName"] =(String) Session["UserName"] %>;
            <a href=temp.aspx? destpage=homedn g.asp>go to Finance</a>

            temp.aspx
            -----------
            <TITLE>test.asp x</TITLE>
            <script language="C#" runat="server">
            private void Page_Load(objec t sender, EventArgs e){
            Response.Write( "<form name=t id=t action=../finance/icrfin/homedng.asp
            method=post>" );
            foreach(object it in Session.Content s)
            {
            Response.Write( "<input type=hidden name=" + it.ToString());
            Response.Write( " value=" + Session[it.ToString()].ToString() + " >");
            }
            if (Request.QueryS tring["target"] !=null)
            Response.Write( "<input type=hidden name=target value="+"homedn g.asp"+">");
            Response.Write( "</form>");
            Response.Write( "<scr"+"ipt>t.s ubmit();</scr"+"ipt>");
            }
            </script>

            temp.asp
            ---------

            <%
            for i=1 to Request.Form.Co unt
            Session(Request .Form.Key(i))=R equest.Form(i)
            'Response.write ( i & ": " & Request.Form.Ke y(i) & ": " & Request.Form(i) &
            "<BR>")
            next
            'Response.End
            Server.Transfer (Session("../finance/icrfin/homedng.asp"))
            %>

            homedng.asp (this is the final page in which i want the username from the
            first page to appear)
            --------------
            <%
            for each x in Session.Content s
            Response.Write( x & "=" & Session.Content s(x) & "<br />")
            next
            %>

            This code works perfectly on localhost but when put on a public webserver
            where many users access it simultaneously, it fails to get the user name got
            in the first page through windows authentication to be passed to the
            homedng.asp page.

            Pls advice. Thanks!

            Comment

            Working...