Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
I have a funny issue with my asp.net c# website. The problem only comes when i upload the solution online, it just works fine when I am running on local machine.
 
Basically, i have a normal login page where I take username and password via text boxes, match it against the db and upon validity, I set up some session variables
(Session["user_in"])
and navigate user to default.aspx page.
 
On this default.aspx page under
page_load 
event, I have following code
 
if (!IsPostBack)
        {
            if ((Session["user_in"] != "Y"))
            {
                Response.Redirect("~/Login.aspx");
            }
           
        }
 
And on this default.aspx page, I am reading from db and writing to db.
 
But annoyingly after a few postback, i get signed out to
Login.aspx
page.
 
And the only code on the page that does that is under if condition in page_load event, meaning that it cannot find the value of
(Session["user_in"])
.
 
This only happens when i upload solution to the server, local machine doesn't behave that way.
 
Any ideas, help please?
Posted 26-Feb-13 1:27am
skaey102

1 solution

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

Solution 1

A few things to look into:
 
1) Session Timeout - From your question, I am guessing this isn't a problem for you. Still just make sure you have required session timeout set in your web.config file.
2) Are you abandoning your session somewhere? Does this happen on a particular page or it happens randomly on any page?
3) Do you have a logging in place? What have you done to deal with unhandled exceptions? You have logs, you should check them out if there is something relevant. You should also check the event viewer on the server. It usually logs unhandled exceptions as well.
 
These are just a way to narrow down your problem. Start with them and let us know if you have any success.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 375
1 Sergey Alexandrovich Kryukov 195
2 Prakriti Goyal 177
3 jlopez788 134
4 Kruti Joshi 117
0 OriginalGriff 6,742
1 Sergey Alexandrovich Kryukov 5,479
2 Maciej Los 3,474
3 Peter Leow 3,313
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 26 Feb 2013
Copyright © CodeProject, 1999-2014
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