Click here to Skip to main content
13,256,716 members (52,438 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace seesion
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["username"] = TextBox1.Text;
            Session["password"] = TextBox2.Text;
        }
 
        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect("WebForm2.aspx");
        }
    }
}


What I have tried:

obviously, the correct output should come like this:
" welcome aany
yoursession id is:sqsvwn3wn1fxc2vig0vk5wc
sessioncount:2
session timeout value is 20"

but does not come in redirect page "webFrom2.aspx" in that webForm.aspx there only 4 label to print above crt output.

pls frds give crt code for this problem
Posted 14-Nov-17 7:35am
Updated 14-Nov-17 17:51pm
Comments
F-ES Sitecore 14-Nov-17 12:42pm
   
> obviously, the correct output should come like this

You haven't given the aspx or code-behind for webform2 so I disagree that it's "obvious" what the output should be.
Raghavendra Priya 14-Nov-17 12:59pm
   
sry I am school student basic level in c#. pls crt my code with refer to my output and send to me crt code pls sir
GobblesGobbles 14-Nov-17 15:54pm
   
Your question does not make any sense.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Refer this with your code and correct it.
WebForm2 ASPX
<div>

       <asp:Label ID="lblInfo" runat="server"></asp:Label> <br />
       <asp:Label ID="lblSession" runat="server"></asp:Label><br />
       <asp:Label ID="lblSessionCount" runat="server"></asp:Label><br />
       <asp:Label ID="lblSessionTimeOut" runat="server"></asp:Label><br />

   </div>


WebForm2 Code Behind CS
public partial class WebForm2 : System.Web.UI.Page
   {
       protected void Page_Load(object sender, EventArgs e)
       {
           if (!Page.IsPostBack)
           {
               lblInfo.Text = string.Format("Welcome {0}", Session["username"]);
               lblSession.Text = string.Format("Your Session Id is {0}", Session.SessionID);
               lblSessionCount.Text = string.Format("sessioncount : {0}", Session.Count);
               lblSessionTimeOut.Text = string.Format("session timeout value is {0}", Session.Timeout);
           }
       }
   }
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 14 Nov 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100