Click here to Skip to main content
13,737,646 members
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)

What I have tried:

obviously, the correct output should come like this:
" welcome aany
yoursession id is:sqsvwn3wn1fxc2vig0vk5wc
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 6:35am
Updated 14-Nov-17 16:51pm
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
‭011111100010‬ 14-Nov-17 15:54pm
Your question does not make any sense.

1 solution

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

Solution 1

Refer this with your code and correct it.
WebForm2 ASPX

       <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 />


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);

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 | Cookies | Terms of Service
Web04-2016 | 2.8.180920.1 | Last Updated 14 Nov 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

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