Passing Session Variables from ASPX to ASP application

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!
 
G

Guest

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

Thanks again!
 
G

Guest

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!!
 
G

Guest

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!
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top