Sessions Lost When The Page Is Reloaded (ispostback = False)?
Feb 27, 2010
I have an asp.net page that sets a few session variables. On my development machine (localhost), I do a postback and the session values are still populated.
When I Reload the page by clicking on the url bar and pressing enter the session variables are still there.
However when i deploy this page to a webserver, the page still retains the session values when doing a postback, but as soon as i click the url and press enter the session values are lost (where the ispostback = false)
But when i press the refresh button the session variables are present (but i do get a popup warning me that the page data needs to be resent!)
i am running IE 7, and the webserver is iis6 what am i doing wrong?!
View 2 Replies
Similar Messages:
Mar 23, 2011
I'm developing a custom URL Rewriter for a ASP.Net 3.5 project. This rewriter is not functionally different than most rewriters out there, the only difference being that the friendly URL collection is not loaded from a web.config file -- it's coming from a database instead. I made the naive assumption that it would be easy to develop a custom rewriter module from scratch, but now I know the mess I put myself in. I digress; let's go straight to the technical issues.
While testing the rewriter, I set up a friendly url that would take the user to a web form. Postbacks from this form should not alter the friendly address, as anyone would expect, sohttp://my.web.site/app_root/FriendlyURL is always rewritten asttp://my.web.site/app_root/not_friendly/form.aspxThings are fine when the browser first loads the FriendlyURL. The page comes up and is completely functional. However, when the form is posted back to the server, the page simply reloads but, at server-side, IsPostBack is false. It's like F5 was hit, except that a HTTP POST had indeed occurred.Unsurprisingly, when the interaction occurs through the "unfriendly" URL, the POST action triggers the postback as expected. This evidence suggests that HttpContext.RewritePath is somehow messing with the page lifecycle in a way that it loses sense of the postback operation.
View 1 Replies
Feb 8, 2010
When any of my page is idle for about 20 minute, and after that if I hit any button, like Sumit Button or any other button, at this time, Page.IsPostback is again False, and none of the click event is fired and page gets reloaded again.
This happens only if I go like this, open up any of my webpage, keep it idle OR do nothing for about 20 minute, exactly on 21st or 22nd minute, Click on any of the button on the page, and the page gets reloaded, click event does not get fired. I debugged for this and I checked the Page.IsPostback value at this point and I got it as False after 20 minute, I don't know why. It should be True. And because of this my page gets reloaded and nothing gets submitted and every control is in the blank position once again and user have to enter everything again.
But if I enter everything and hit any of the button or Submit button within 20 minute, then everything works fine, Submit button's click event is also gets fired and everything works perfect.
And this is happening in all of my page. I am not sure what configuration is wrong.
But just for more details, I have a master page, I am using Telerik Controls and I have session Timeout set as 60 minute everywhere, in web.config and in IIS settings and in my App_Pool also. On my Master Page, I have ASP:ScriptManager, Tekerik:RadMenu, ASP:ContentPlaceHolder controls and some other controls and javascript code too.
[code]....
View 9 Replies
Apr 16, 2010
I have a page with a (gridview nested within a gridview) in an UpdatePanel (UpdateMode="Conditional"). The nested gridview drops down when you click on an arrow and then you can click on each subgrid rows command field. The gridviews are loaded from the Page_Load event. When I click on the commandfield in the subgrid the Page_Load fires during the partial page postback. From what I have read this is normal with UpdatePanels. But What I don't understand is why both Page.IsPostBack and ScriptManager.GetCurrent(Page).IsInAsyncPostBack test false after I click on the command field in my grid. I need to stop the rebinding of the gridviews ( which causes the subgrid to collapse ) when the command field is clicked.Also: I am using MasterPages and the <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> is located in my mater page form section.Would anyone have any suggestions how to test if a partial page postback is occuringHere is a link to the page source: http://pastebin.org/153774here is a link to the code behind: http://pastebin.org/153781
View 2 Replies
Oct 7, 2010
When Session attribute Cookieless ="True" the page.Ispostback is always false.Cant understand the reason behind it.
And one more thing what is happening when we click Remember Me option in login control.As per my knowledge it is storing authentication cookie in it. If we can add data to authentication cookie then why we need session...we can add session data in that.. and authentication token is also regenerated for every new request like sessions.....i got confused after browsing for few hours.
Which one is more secure using cookies or URL for authentication and session.
View 1 Replies
Sep 29, 2010
I am working on rewriting URLs Urlrewriting.net, and have run into what seems to be a common problem but I can seem to fix it. I'll present a simplified case.
The URL rewriting is working perfectly with the rule:
<urlrewritingnet rewriteOnlyVirtualUrls="true" defaultPage="default.aspx" defaultProvider="RegEx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<rewrites>
<add name="catalog" virtualUrl="^~/catalog/(.*)/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/catalog.aspx?cid=$1&c=$2" ignoreCase="true"/>
</rewrites>
</urlrewritingnet>
On the page I have a DataList with 2 asp:buttons inside. When clicked, the page refreshes but does nothing.
I followed ScottGu's article to impliment a form control adapter to rewrite the action of the form to match the rewritten URL.
Page URL in the browser:
[URL]
<form name="aspnetForm" method="post" action="/dev/catalog/13/Music.aspx" id="aspnetForm">
I now see the correct URL on the form action, and when debugging I can see the page load event firing.
The problem now is that every time the page loads Page.IsPostback is false, causing the page to rebind the DataList and therefore ignore the ItemCommand the buttons should be triggering.
if (!Page.IsPostBack)
PopulateControls();
I'm using .NET 3.5 SP1, there is a ScriptManager on the master page but no UpdatePanel on this page. I've also tried resetting the Form.Action property and bypassing ScottGu's solution with the same result. If I go to the page URL directly without using the rewriter everything works fine.
View 3 Replies
Apr 23, 2010
I have a strange problem, my webform is loading twice.
when i debug i see ispostback is showing false for both times.
what happened to the first time load , and the viewstate.
What can remove all info from viewstate and making the ispostback again to false.
i am having real difficulty figuring out what is causing this problem.
View 3 Replies
Mar 24, 2010
I have an application using login-controls.
I have this code in my webconfig:
<authentication mode="Forms" >
<forms loginUrl="default.aspx" protection="All" defaultUrl="index.aspx" timeout="100000"></forms>
</authentication>
My problem is:
If I do not activate my application for 30 minutes (my customers wants to be online all day without logging out) my session for user login is lost. How can I automatically refresh my sessions if there has been no activity for e.g. 10 minutes? It's a sort of keep-alive that I want. I thought the problem was sloved when I set the timeout to 100000 but it doesn't help
Note. My application works with the remember me function but it losses its sessions after 30 minutes.
View 8 Replies
Jan 28, 2012
This is my page code
Code:
Protected Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
Dim blnLogin As Boolean
blnLogin = Login(txtUserLogin.Text, txtPassword.Text)
If blnLogin = True Then
[Code] .....
So after the user presses the Login button there should be 3 variables stored in a session, this works (checked using trace='true')
Session State
Session KeyTypeValue
LoggedInSystem.String
LoggedInUserSystem.StringUser
LoggedInIDSystem.Int322
That's fine. Now I click on the AddToWall button to check if I can get the LoggedInID, it shows an empty messagebox.
In the trace there are no Sessions keys left.How can I make it keep the keys after postback/after clicking on buttons?
Note: When calling GetFriends(Session("LoggedInUser")) in the same sub as the Login button the variable does get passed to the class with sub GetFriends()
Here's my web.config
Code:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<sessionState timeout="30" />
</system.web>
</configuration>
View 3 Replies
Oct 1, 2010
I have health monitoring enabled on a production system (asp.net webforms .net 4) and I see that there's a lot of errors being sent to me indicating that a session variable has been lost.(I am trying to attach something out of session state to a entity framework data context and get a "Value cannot be null, parameter n ame entity" error). So somehow the session variable now contains null and not an object. Interestingly we have the same application deployed on two separate servers - one DMZ server for external users and one internal server for internal users. Both of these applications on two different servers seem to have the same problem.
Health Monitoring is also monitoring lifetime events and I can see from this that we do not have something like IIS recycling, config changes, changes to bin folder, recompilations etc, occuring. I've read this page: [URL] I can confirm that it's not a Response.Redirect problem because that's not happening - this is an online application form - it puts an object in session state on page_load and there's a multiview - when "next" is pressed, the object comes out of session state, is attached to the data context, changes are made from the web form and the datacontext updated. So there's no response.redirect happening.
I can also confirm the details in "Update 1" and "Update 2" from that link are not relevant to me - there is only 1 worker process running in the application pool and the server name or web address do not contain underscores. I also persued the possibility of session timeouts occuring but they should be handled by other code which is running to detect session timeouts (see: [URL]) which I have tested over and over - Part of the problem is I just cannot reproduce this error myself.......................
View 1 Replies
Apr 23, 2010
I have a session state that myself and others on my team have been bashing our heads against the wall for the past week. We have tracked it down to the following:
1) Frame page containing content pages creates a session
2) Content page creates a session, stores data in the session
3) User changes drop down list with SelectedIndexChanged autopost back and displayed fields are changed using an UpdatePanel. A new session is created, data stored in the prev. session is lost
4) User posts back, no session is created this time, however the post back fails because the session from step 2 is lost.
Now, a user closes the page, comes back, and it actually starts to work:
1) Frame page containing content page opens (no new session)
2) Content page loads data, stores in session (no new session)
3) User changes drop down list with SelectedIndexChanged auto postback and displayed fields are changed using an UpdatePanel. Sesson NOT lost
4) User posts back form, success
ASP.NET on the first visit to the site insists on creating 3 sessions, we log it in Session_Start. I can't think of any reason this should happen. I've been told the frame will always be on a seperate session; thats fine, its only being used to setup scrolling
within a frame in Dynamics CRM. The biggest question is why when we insert data into the session in step #2, it is discarded in step #3.... but only during the first visit to the page!
I've never seen this session behavior before; we don't have any session abandonments in our code, and we never clear session objects, so there shouldn't be any reason for the session to be lost.
View 2 Replies
Jul 26, 2010
I have a masterpage that is used as master page for all the pages in my application. I have no issues with the forms and pages. However, currently when any page is loaded master page gets reloaded. I think it is not efficient if master page is reloaded everytime the application paged are loaded. The desired behaviour is to have the master page loaded once and reload it again when a user logs in as the login/password elements are within the master page in the header section. Other than these situations I see no need for master page to get reloaded. Optimally when a user clicks on a link on the navigation bar (which is in the master page) I would like the header section in the master page to remain in the page and just the content section gets reloaded.
View 10 Replies
Feb 20, 2010
Ive set up a basic client side callback to a WCF service. see sample code below.
when viewing using an http filter attached to the explorer you can see that:
1. service1.svc/js is working fine and return proper java script to the browser
2. serrvice1.svc works and returns a proper json data.
3. call is fine and using alert instead of updating the div info i get the data.
but then after OK on the alert the page is then reloaded from scratch.
[Code].....
View 2 Replies
Dec 29, 2010
I had found one line code in vb which did this, using the System.Web.UI.Page, but I can't find it back. Someone could tell me what it was ?
View 3 Replies
Feb 28, 2011
I have a [WebMethod] within an aspx.cs file. It seems that whenever a second call to the method is made via AJAX before the first call is fully executed, the web method completely stops functioning until the page is reloaded.
View 2 Replies
Dec 20, 2010
$(document).ready(function() {
View 1 Replies
Jan 17, 2011
I dynamically add the webcontrol in onInit or onload (page_load). it will cause the second post back and with the ispostback==false;
if first enter the page is no problem. but if I click on the some button. it will trigger postback two times.
first time: ispostback = true.
second time: ispostback = false.
the second time postback caused me headache because all my value has been initialized due to the coding like below:
DataTable _temp;
if(! ispostback)
[Code]....
View 2 Replies
May 28, 2010
I want to don't let the page to go back ,for that i am using the code to expire the page after the first time it loads so that when second time the page will load it will not find the such page in cache ,but problem is that my code is not working propely when i am using page.Ispostback, iam inserting my code here[Code]....
View 1 Replies
Apr 22, 2010
What is the best sequence order for Page.IsPostBack and User.Identity.IsAuthenticated? From what I have search for, this comes up most common:
If Not Page.IsPostBack Then
If User.Identity.IsAuthenticated Then
~Some kind of code~
End If
End If
Is this considered "best practice" or can the two items - Page.IsPostBack and User.Identity.IsAuthenticated -be split into their own sections so the fuctions of these can be independent of each other?I am trying to troubleshoot a placeholder that disappears from a master page when a content page button is pressed to change the content pages active view (I have a multiview w/ 5 views inside of it).
View 2 Replies
Jan 6, 2011
In my asp.net project, I have a view-image page and an upload-image page. I upload an new image and direct to the view page, the image doesn't be changed, because IE won't reload the image if the image's url remains the same. prefer the way to ask the browser to reload the image independently without server setting or web-headers changes.
View 2 Replies
Jan 6, 2011
In my asp.net project, I have a view-image page and an upload-image page. I upload an new image and direct to the view page, the image doesn't be changed, because IE won't reload the image if the image's url remains the same.
prefer the way to ask the browser to reload the image independently without server setting or web-headers changes.
View 2 Replies
Jun 4, 2010
I have our site setup with 2 master pages.. one is for the general public and the other is for our admin section..
We are going to be updating the general pages to check the users job title to help customize the pages for them. Is it possible to add the code we are going to use to set the sessions to the master page of the general section and have it set the sessions. Or will i have to update each page individually with the logic and handle each page seperatly?
I have another post asking for help on setting the sessions, but once that is done, i'd like to know if adding that code to the master page will accomplish what i want, by just having it in one place and easier to maintain. Or will i have to add the code to each page i want to check the session values...
http://forums.asp.net/t/1558938.aspx ( this is where im asking for help with the sessions )
View 5 Replies
Mar 22, 2010
I have just added the following to the very last page of my application.
[Code]....
And then i have this on each of the pages before the last, within my Page_load:
[Code]....
I have different sessions thruout the application process, but this one session is only set at the beginning of the process and once i kill it on the last page, any attempt to hit Back or trying to access any page directly without first starting, i need to force them to the beginning, what am i missing or doing wrong?
sessID is set on page 1 and is available until you get to the last page. Where i added the Session.Abandon(); Now if i get to the last page and hit back before the refresh occurs, im able to go back, but the page comes up with null reference for other sessions that are obvisously cleared / killed with the abandon. So i should have to check for each session should i? I mean if the abandon killed them all, then checking for the main session should be enough right?
View 7 Replies
Mar 3, 2011
My website use master page as template. All my other pages spread in different level folder. Master page will get images (which use related path - related to master page) from style sheet file which located in App_themds's sub folder. When application run,The page will lost all images if the content page did not located in the same level as Master page.
View 3 Replies
Sep 10, 2010
Building asp.C# shopping app that is using a hosted payment page to process payments (using posting of data to a hosted payment page). SSL certificate is signed and installed.
Flow:
Prelim) (HTTPS) Users authenticate using asp Login control
1) Users add items to cart.
2) (HTTPS)Users go to checkout page.
3) Users finalize their order, then click pay now after agreeing to T&C.
4) Server gets cart data (from MSSQL2005) and sets a transaction cookie (expiry set to 20 mins).
5) (HTTPS) Server Response.Redirects to an html page (in the same folder as the login protected pages).
6) Html page reads transaction cookie data and generates form fields.
7) (HTTPS) Html page posts data to hosted payment page (php).
8) User enters payment info and clicks pay now.
9) (HTTPS) hosted payment page posts info back to a .aspx page that checks if payment OK.
10a) If payment !OK, redirects to a declined page.
10b) (HTTPS) If payment OK, sets a verification cookie (expiry set to 20 mins). Then redirects to another html page.
11) Html page reads cookie data and generates form fields.
12) (HTTPS) Html page posts data to hosted verification page (php).
13) Verification page verifies (of course), if transaction ok.
14) (HTTPS) verification page posts data to a .aspx page that checks if verification OK.
15) If verification OK, process orders and do receipt stuff.
Issue:
This control flow was tested on an unsigned dev environment. SSL was being enforced, if needed on the unsigned SSL certificate. So we'd get prompts that certificate may be bad, but the control flow worked seamlessly.
However, now live with a signed SSL certificate, going from step 5 to 6, we are encountering a situation where some users (not duplicated every time, but verified that it does occur) when they click pay now and are redirected to the html page, they are forced back to the ~/login.aspx page (as if they were logged out).
Things to note:
a) The session did not time out.
b) The browsers have cookies and javascript enabled.
c) I can process the entire flow seamlessly on the same machine with other accounts, and occasionally, the same account.
So, basically, I'm stumped... Is this a viewstate error? A login control bug that won't let me redirect to an html page because it is now using a real SSL? Anyone have any experience with this kind of deal? I'm at a loss for solutions at this point.
View 1 Replies