c# - Loss of session and application ended randomly? -
i have sessions recording user's log in information gets lost due application ending.
running code local host have no issues, have lunched site live lose session in minutes.
i decided log golbal.asax file , record when session started , ended , when application starts , ends , if there application errors.
when user navigates thought website session checked if null, if session not null register hidden fields page use session values, if sessions null abandon them , redirect login page.
here log has shown me:
[11:52:25] application has started [11:52:25] session has started [11:52:35] use session [11:52:45] use session [11:52:54] use session [11:52:59] use session [11:53:5 ] use session [11:53:10] use session [11:53:15] use session [11:53:18] session has ended [11:53:18] application has ended [11:53:22] application has started [11:53:23] session has started [11:53:23] abandon session [11:53:23] session has ended [11:53:23] session has started
i navigated around site 7 clicks on same hyper link refreshing page on, unknown reason session lost , application ended. can see log, within minute.
when navigation link clicked code check session.
protected override void oninit(eventargs e) { logclass log = new logclass(); if (this.session != null && this.session.count > 0) { log.logger("use session"); string email = (string)this.session["email"]; int practiceid = (int)this.session["practiceid"]; int practitionerid = (int)this.session["practitionerid"]; this.clientscript.registerhiddenfield("loggedinusername", email); this.clientscript.registerhiddenfield("practiceid", practiceid.tostring()); this.clientscript.registerhiddenfield("practitionerid", practitionerid.tostring()); } else { log.logger("abandon session"); this.session.abandon(); response.cookies.add(new httpcookie("asp.net_sessionid", "")); response.redirect("~/default.aspx"); } base.oninit(e); }
what causing session lost quickly, , why problem when hosted live , not problem local host?
what causes application end, since have no application errors logged?
Comments
Post a Comment