Click here to Skip to main content
15,904,023 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How to read available control from a aspx file? Pin
Md. Marufuzzaman1-Jan-10 3:59
professionalMd. Marufuzzaman1-Jan-10 3:59 
GeneralRe: How to read available control from a aspx file? Pin
N a v a n e e t h1-Jan-10 4:20
N a v a n e e t h1-Jan-10 4:20 
GeneralRe: How to read available control from a aspx file? Pin
Md. Marufuzzaman1-Jan-10 5:15
professionalMd. Marufuzzaman1-Jan-10 5:15 
Questionadd fieldset control on run time Pin
S.Aijaz31-Dec-09 20:43
S.Aijaz31-Dec-09 20:43 
AnswerRe: add fieldset control on run time Pin
m-khansari1-Jan-10 18:43
m-khansari1-Jan-10 18:43 
QuestionContinue C++ managed AND unmanaged project in VB Pin
chana gibber31-Dec-09 9:34
chana gibber31-Dec-09 9:34 
AnswerRe: Continue C++ managed AND unmanaged project in VB Pin
Abhijit Jana31-Dec-09 9:40
professionalAbhijit Jana31-Dec-09 9:40 
QuestionSession being lost in a simple test webpage Pin
jpegny31-Dec-09 9:29
jpegny31-Dec-09 9:29 
Hi,

I'm using visual studio 2008 and it's built in development webserver, with C# as the codebehind language.

I'm trying to make a simple webapp in which you click a button which sets a session var (that part is working) and in the pageload
i'm checking to see if it's a postback and if the session is not null. problem is that every time the session is null.
I have done this successfully before with visual studio 2003 and on IIS.

Here is the relevant code:

<br />
protected void Button1_Click(object sender, EventArgs e)<br />
        {<br />
            Session["testvar"] = 25;<br />
<br />
            /*<br />
            if (Session["testvar"] == null)<br />
                Response.Write("s is null");<br />
            else<br />
                Response.Write("s is NOT null");<br />
            <br />
            */<br />
        }<br />
<br />
<br />
        protected void Page_Load(object sender, EventArgs e)<br />
        {<br />
            if (IsPostBack)<br />
            {<br />
                int x;<br />
<br />
                //x = (int)Session["testvar"];<br />
<br />
                <br />
                if (Session["testvar"] == null)<br />
                    Response.Write("test var is null");<br />
                else<br />
                {<br />
                    x = (int)Session["testvar"];<br />
                    TextBox1.Text = x.ToString();<br />
                }<br />
<br />
                <br />
<br />
            }<br />
        }<br />
<br />
<br />



Any help is appreciated.
Thanks
AnswerRe: Session being lost in a simple test webpage Pin
Abhijit Jana31-Dec-09 9:39
professionalAbhijit Jana31-Dec-09 9:39 
GeneralRe: Session being lost in a simple test webpage Pin
jpegny31-Dec-09 9:42
jpegny31-Dec-09 9:42 
AnswerRe: Session being lost in a simple test webpage Pin
Sir Dot Net31-Dec-09 11:55
Sir Dot Net31-Dec-09 11:55 
GeneralRe: Session being lost in a simple test webpage Pin
jpegny31-Dec-09 12:30
jpegny31-Dec-09 12:30 
AnswerRe: Session being lost in a simple test webpage Pin
pd695-Jan-10 23:35
pd695-Jan-10 23:35 
QuestionWeb page compiler error Pin
mavoc31-Dec-09 7:50
mavoc31-Dec-09 7:50 
AnswerRe: Web page compiler error Pin
Abhijit Jana31-Dec-09 8:23
professionalAbhijit Jana31-Dec-09 8:23 
GeneralRe: Web page compiler error Pin
mavoc1-Jan-10 7:18
mavoc1-Jan-10 7:18 
GeneralRe: Web page compiler error Pin
Abhijit Jana2-Jan-10 9:21
professionalAbhijit Jana2-Jan-10 9:21 
GeneralRe: Web page compiler error [modified] Pin
mavoc4-Jan-10 6:50
mavoc4-Jan-10 6:50 
QuestionGetting function value Pin
Hema Bairavan31-Dec-09 4:47
Hema Bairavan31-Dec-09 4:47 
AnswerRe: Getting function value Pin
Abhishek Sur31-Dec-09 6:41
professionalAbhishek Sur31-Dec-09 6:41 
GeneralRe: Getting function value Pin
Hema Bairavan31-Dec-09 6:49
Hema Bairavan31-Dec-09 6:49 
GeneralRe: Getting function value Pin
Abhishek Sur31-Dec-09 7:15
professionalAbhishek Sur31-Dec-09 7:15 
GeneralRe: Getting function value [modified] Pin
Hema Bairavan31-Dec-09 8:06
Hema Bairavan31-Dec-09 8:06 
GeneralRe: Getting function value Pin
Abhishek Sur31-Dec-09 8:39
professionalAbhishek Sur31-Dec-09 8:39 
Questionasp.net vb radiobuttonlist object reference Pin
janetb9931-Dec-09 4:31
janetb9931-Dec-09 4:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.