Session Problem

Last post 07-07-2009 9:11 AM by jeyaseelan@ajsquare.net. 11 replies.

Sort Posts:

  • Session Problem

    07-06-2009, 1:52 AM
    • Member
      8 point Member
    • dev.sheoran
    • Member since 01-02-2009, 12:51 PM
    • New Delhi, India
    • Posts 24

    Hi All,

            I have two registration form. On filling the first form, a session is created and the user is redireted to the second page. In IE, there is no problem everthing is working fine. But in Mozilla , session becomes null and user is redireted to the login page as i have a check on page_load event of second page if session is missing.

    Why this is happening?

    Please Help.


    Thanks,

    Dev

  • Re: Session Problem

    07-06-2009, 5:40 AM
    • Member
      561 point Member
    • harieis
    • Member since 04-23-2009, 12:11 PM
    • Trivandrum
    • Posts 150

     Please Paste ur code .....

    It will be very helpful.pls

    Please, Mark as Answer if this reply helped you
    ==============================================

    Harikrishnan.S
    Trivandrum,Technopark,
    Kerala,
    India
    harikrishnans82@gmail.com
    ==================================================
  • Re: Session Problem

    07-06-2009, 5:41 AM
    • Member
      549 point Member
    • adeelehsan
    • Member since 07-18-2005, 10:56 AM
    • UAE
    • Posts 94

    Hello

    Just a quick tip, make sure that when you are setting or accessing the session, use the following:

    [VB]

    HttpContext.Current.Session("Var")="Value"

    [C#]

    HttpContext.Current.Session["Var"]="Value";

    Please Mark AS Answer if it helped.
    Regards
    ADEEL EHSAN
  • Re: Session Problem

    07-06-2009, 5:48 AM
    • Member
      258 point Member
    • mihir.mone
    • Member since 05-20-2008, 4:59 AM
    • Mumbai, India
    • Posts 73

    Hello,

    If it is working fine with IE then your code seems to be right.

    Would like to see your code and the way you access on Mozilla.

    And yes, Clear cache before any request..

    Mihir,
    Software Professional
    http://mihirhere.spaces.live.com
  • Re: Session Problem

    07-06-2009, 6:31 AM
    • Member
      8 point Member
    • dev.sheoran
    • Member since 01-02-2009, 12:51 PM
    • New Delhi, India
    • Posts 24

    Thanks for reply. Here is the code :

    Page1.aspx.cs :

    protected void btnSaveNext_Click(object sender, ImageClickEventArgs e)
        {

    try{

           Session["RowId"] =rowID;

           Response.Redirect("Page2.aspx", false);

       }

    catch{}

    }


    Page2.aspx.cs :


    protected void Page_Load(object sender, EventArgs e)
        {

    if (Session["RowId"] == null )
            {
                Response.Redirect("login.aspx", false);
            }

    }


    Thanks,

  • Re: Session Problem

    07-06-2009, 7:10 AM
    • Member
      561 point Member
    • harieis
    • Member since 04-23-2009, 12:11 PM
    • Trivandrum
    • Posts 150

    Helllo


    Your  Code having no problem....Plese send ur version of the firefox..

    Please, Mark as Answer if this reply helped you
    ==============================================

    Harikrishnan.S
    Trivandrum,Technopark,
    Kerala,
    India
    harikrishnans82@gmail.com
    ==================================================
  • Re: Session Problem

    07-06-2009, 7:18 AM
    • Member
      258 point Member
    • mihir.mone
    • Member since 05-20-2008, 4:59 AM
    • Mumbai, India
    • Posts 73

    Hello,

    As I said, it must not be problem of your code as you can do it with IE.

    Did you clear cache before making any new request on FF?

    1. Clear cache, close and open FF again.

    2. You may debug, add breakpoint on page2 to see what Session contains.

    3. Use 'True' in response.redirect method, this will stop execution of current page.

    Kindly try this and let me know.

    Mihir,
    Software Professional
    http://mihirhere.spaces.live.com
  • Re: Session Problem

    07-06-2009, 7:56 AM
    • Member
      8 point Member
    • dev.sheoran
    • Member since 01-02-2009, 12:51 PM
    • New Delhi, India
    • Posts 24

    Hi mihir,

    I tried your solution but didn't succeed.

    I am using FF 3.0 but i have checked it on loder version also.

    Thanks,

  • Re: Session Problem

    07-06-2009, 9:01 PM
    • Star
      12,535 point Star
    • malcolms
    • Member since 06-12-2008, 4:38 AM
    • Melbourne, Australia
    • Posts 2,056

    Your code seems fine.  The best way to find out what's happening is inserting some Debug statements in your code to see the values of your session objects.

    I your first page after you assign the session value, do a Debug.WriteLine(Session["yourobject"]) to see what the value is.  Then do the same on the second page.

    Sincerely,
    Malcolm Sheridan

    Microsoft Certified Solution Developer
    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as
    Answer" if a marked post does not actually answer your question.
  • Re: Session Problem

    07-07-2009, 1:30 AM
    • Member
      8 point Member
    • dev.sheoran
    • Member since 01-02-2009, 12:51 PM
    • New Delhi, India
    • Posts 24

    Hi,

                            I have tried all of the above solutions  but no one works.

                            I have debug the code. It is creating session variable on the page1. But when i debug on page2 , the session becomes null on the page_load event . It is very strange behaviour. Today i check on live server, it sometime works fine and sometimes it dosn't work and on local it never works.

    Please help me. 


    Thanks to all,

  • Re: Session Problem

    07-07-2009, 2:25 AM
    Answer
    • Star
      12,535 point Star
    • malcolms
    • Member since 06-12-2008, 4:38 AM
    • Melbourne, Australia
    • Posts 2,056

    Okay so it's good the session is being created on page 1.  I think the best thing to do would be to set a conditional breakpoint on your session and have it jump into debugging mode if the value changes.

    http://support.microsoft.com/kb/308469

    Sincerely,
    Malcolm Sheridan

    Microsoft Certified Solution Developer
    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as
    Answer" if a marked post does not actually answer your question.
  • Re: Session Problem

    07-07-2009, 9:11 AM
    Answer

    dev.sheoran thanks for your post.

    I have gone through your code its fine. Can you try these scenario

    1. Reset your IIS and run the applicaiton.

    2. Set break point and see the line Session["YourSessinName] = variable;

    what value is having that variable and set this line within try catch block, so that we find if any thing wrong while assign the value.

    Please let me know if your problem is not solved.

    Any doubts please feel free to ask me.

    If this post is answer of your question then don't forgot to Click Mark As Answer.

    Thanks & Regards,
    J.Jeyaseelan
Page 1 of 1 (12 items)