D
Dimiter Andonov
Hi guys,
Here is the situation I'm fighting for two days without any success:
I work on a part of classic ASP application that has to be migrated to
ASP.NET. I know that ASP session variables cannot be directly accessed
in ASP.NET and vice versa. So, I have designed four pages in order to
transfer the session state in both directions (ASP to ASP.NET, ASP.NET
to ASP).
Here are those pages:
1. ASP to ASP.NET
a) ASPtoASPNET.asp
<%
Response.Write("<form name=t id=t action=ASPtoASPNET.aspx method=post
Request.QueryString("target") & ">")
For each Item in Session.Contents
Response.Write("<input type=hidden name=" & Item)
Response.Write(" value=" & Session.Contents(item) & " >")
next
Response.Write("</form>")
Response.Write("<script>t.submit();</script>")
%>
b) ASPtoASPNET.aspx
private void Page_Load(object sender, System.EventArgs e)
{
for(int i = 0; i < Request.Form.Count; i++)
{
Session[Request.Form.GetKey(i)] = Request.Form.ToString();
}
Server.Transfer(Session("destpage").ToString());
}
2. ASP.NET to ASP
a) ASPNETtoASP.aspx
private void Page_Load(object sender, System.EventArgs e)
{
string destpage = Request.QueryString["destpage"];
Response.Write("<form name=t id=t action=ASPNETtoASP.asp?destpage=" +
destpage + " method=post>");
foreach(object it in Session.Contents)
{
Response.Write("<input type=hidden name=" + it.ToString());
Response.Write(" value=" + Session[it.ToString()].ToString() + "
Response.Write("</FORM>");
Response.Write("<scr" + "ipt>t.submit();</scr" + "ipt>");
}
b) ASPNETtoASP.asp
<%
url = Request.QueryString("destpage")
Response.Write("<form name=t id=t action=" & url & "
method=post></form>")
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.Write("<script>t.submit();</script>")
%>
The problem is that session is lost randomly without any pattern. To
make my life even worse that happens only on the production
environment (I have no control there). On my test environment
everything is just fine.
Have anyone any idea what's wrong?
Thank you in advance,
Dimiter Andonov
Here is the situation I'm fighting for two days without any success:
I work on a part of classic ASP application that has to be migrated to
ASP.NET. I know that ASP session variables cannot be directly accessed
in ASP.NET and vice versa. So, I have designed four pages in order to
transfer the session state in both directions (ASP to ASP.NET, ASP.NET
to ASP).
Here are those pages:
1. ASP to ASP.NET
a) ASPtoASPNET.asp
<%
Response.Write("<form name=t id=t action=ASPtoASPNET.aspx method=post
Response.Write("<input type=hidden name=DestPage" & " value=" &
Request.QueryString("target") & ">")
For each Item in Session.Contents
Response.Write("<input type=hidden name=" & Item)
Response.Write(" value=" & Session.Contents(item) & " >")
next
Response.Write("</form>")
Response.Write("<script>t.submit();</script>")
%>
b) ASPtoASPNET.aspx
private void Page_Load(object sender, System.EventArgs e)
{
for(int i = 0; i < Request.Form.Count; i++)
{
Session[Request.Form.GetKey(i)] = Request.Form.ToString();
}
Server.Transfer(Session("destpage").ToString());
}
2. ASP.NET to ASP
a) ASPNETtoASP.aspx
private void Page_Load(object sender, System.EventArgs e)
{
string destpage = Request.QueryString["destpage"];
Response.Write("<form name=t id=t action=ASPNETtoASP.asp?destpage=" +
destpage + " method=post>");
foreach(object it in Session.Contents)
{
Response.Write("<input type=hidden name=" + it.ToString());
Response.Write(" value=" + Session[it.ToString()].ToString() + "
}
Response.Write("</FORM>");
Response.Write("<scr" + "ipt>t.submit();</scr" + "ipt>");
}
b) ASPNETtoASP.asp
<%
url = Request.QueryString("destpage")
Response.Write("<form name=t id=t action=" & url & "
method=post></form>")
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.Write("<script>t.submit();</script>")
%>
The problem is that session is lost randomly without any pattern. To
make my life even worse that happens only on the production
environment (I have no control there). On my test environment
everything is just fine.
Have anyone any idea what's wrong?
Thank you in advance,
Dimiter Andonov