Passing Session Variables from ASPX to ASP application

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
Thanks Peter. How do I do it the other way? Passing passwords from an ASPX
page to classic ASP page.

Thanks again!
 
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!!
 
Example files
==========
finance2.aspx
---------------
<% Session["uName"] =(String) Session["UserName"] %>;
<a href=temp.aspx?destpage=homedng.asp>go to Finance</a>

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

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

<%
for i=1 to Request.Form.Count
Session(Request.Form.Key(i))=Request.Form(i)
'Response.write( i & ": " & Request.Form.Key(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.Contents
Response.Write(x & "=" & Session.Contents(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!
 
Back
Top