you can transfer you asp session to asp.net session. here i give small demo for that.
steps:
1) create asp page (mypage.asp)
1:
2: <%@LANGUAGE="Vbscript" CODEPAGE="1252"%>
3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4: <html xmlns="http://www.w3.org/1999/xhtml">
5: <head>
6: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
7: <title>Untitled Document</title>
8: </head>
9: <form name='form1' action='login.asp' method='post'>
10: User Name : <input type='text' name='username'>
11: <br>
12: <input type='submit' value="Login">
13: </form>
14: <body>
15: </body>
16: </html>
2) create second asp page (login.asp)
1: <%1:2: If Request.Form("username") = "" then3: Response.Write("Login Failed.<br><br>")4: else5: Response.Write("Transfer Session in To Hidden Field")6: ' create asp session user here7: Session("user") =Request.Form("username")8: ' in the form action go to the aspx page called default.aspx9: Response.Write("<form name='form1' id='form1' action='Default.aspx' method='post' >")10:11: For each Item in Session.Contents12: Response.Write("<input type=hidden name=" & Item)13: Response.Write( " value=" & Session.Contents(item) & " >")14: next15: Response.Write("</FORM>")16:17: Response.Write("<script>form1.submit();</script>")18: End If%>
3) create aspx page with (asp.net with c#)
1: <%@ Page Language="C#" %>
2:
3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4:
5: <script runat="server">1:2: protected void Button1_Click(object sender, EventArgs e)3: {4: //redirect to asp page5: Response.Redirect("myasp.asp");6: }7: protected void Page_Load(object sender, EventArgs e)8: {9: //get the Request10: for (int i = 0; i < Request.Form.Count; i++)11: {12: //transfer value13: Session[Request.Form.GetKey(i)] = Request.Form[i].ToString();14: }15: //check the session16: if (Session["user"] != null)17: {18: Response.Write("Hi " + Session["user"].ToString());19: }20: }</script>
6:
7: <html xmlns="http://www.w3.org/1999/xhtml" >
8: <head runat="server">
9: <title>ASPX Page</title>
10: </head>
11: <body>
12: <form id="form1" runat="server">
13: <div>
14: <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
15: </form>
16: </body>
17: </html>
4) now start the application start page is (mypage.asp).
click on the login button it will go to login.asp page.
in the login.asp page session is create Session(“user”) =Request.Form(“username”)
if login is success then page is go to the default.asp.
on the default.aspx page load event
//get the Request
for (int i = 0; i < Request.Form.Count; i++)
{
//transfer value
Session[Request.Form.GetKey(i)] = Request.Form[i].ToString();
}
thnx