Development ASP.Net Tutorial

File: Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Cookieless1" %>
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 


    Untitled Page


    
    

        
            
                
            
            
                
            
            
                
            
        

                                                       runat="server" 
                                   NavigateUrl="NextPage.aspx">Link with Relative Path
                

                    
                

                    
                

    

    


File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Cookieless1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
  {
    Session["test"] = "Test String";
    }
  protected void cmdLink_Click(object sender, EventArgs e)
  {
    Response.Redirect("NextPage.aspx");
  }
  protected void cmdLinkAbsolute_Click(object sender, EventArgs e)
  {
    string url = "http://" + Request.Url.Authority +
      Request.Url.Segments[0] + Request.Url.Segments[1] +
      "NextPage.aspx";
    Response.Redirect(url);
  }
}
File: NextPage.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NextPage.aspx.cs" Inherits="Cookieless2" %>
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 


    Untitled Page


    
    

                           runat="server" 
                   Font-Bold="True" 
                   Font-Names="Verdana" 
                   Font-Size="Large">
    

    


File: NextPage.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Cookieless2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    if (Session["test"] != null)
    {
      lblInfo.Text = "Successfully retrieved " + (string)Session["test"];
    }
    else
    {
      lblInfo.Text = "Session information not found.";
    }
}