469,945 Members | 1,848 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

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!

Jan 18 '06 #1
5 10213
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:
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!

Jan 18 '06 #2
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:
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:
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!

Jan 19 '06 #3
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:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"GeRmIc" wrote:
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:
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:
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!

Jan 19 '06 #4
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!!
Mar 7 '06 #5
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!
Mar 8 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by sumit | last post: by
14 posts views Thread by Michael Carr | last post: by
reply views Thread by Vibhu Bansal | last post: by
2 posts views Thread by ramendra | last post: by
3 posts views Thread by panic | last post: by
22 posts views Thread by K. A. | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.