.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

ASP.NET PageMethods - Back Button Causing 'Authentication Required' Prompt

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :ASP.Net

Since last week I've had a really odd issue with PageMethods and the back button which i've never seen before.

Essentially, I have a 'home page' which on document.ready (using jQuery), loads some data through PageMethods, and then renders a list - from which you can click through to a details page about  the item. In general use, it works fine. However, using the back button after clicking through (ie: going back to the home page), it throws a PageMethods error. The browser's 'authentication required' prompt appears, and if you click cancel, the server returns a 404. The error returned by PageMethods on the client side is 'authentication failed'.

Just FYI, the application is using ASP.NET forms authentication. The weird thing is, this happens as soon as you click the link and click back. It's not like the authentication cookie has expired or anything, and if you click cancel when the prompt appears and refresh the page, it works fine. I just can't work out what is going on.

I've tried disabling caching on the page [as I thought it was something to down with some browsers' caches of the DOM), but the same thing happens.

One workaround i've had is to redirect the page to itself if the PageMethods error is 'authentication failed', which does work - but only when you cancel the authentic

View Complete Post

More Related Resource Links

Posting back a disabled button


Folks, I have a control which inherits from LinkButton and I'm trying to make sure that the user cannot cause mayhem by performing multiple postbacks.  That seemed an easy enough challenge, so I have this code [snippet] on the client:

ButtonClicked: function () {
    if (this._DisableOnClick == true) {
        this.get_element().disabled = 1;
        this.get_element().style.cursor = 'wait';
    else {
        alert('Posting back');

The alert is of course only there for debugging.  If the DisableOnClick value is false, then I see the "Posting Back" alert and, when I click ok, the postback occurs - all good.

If the DisableOnClick value is true, then the "button" gets disabled and the cursor turns into an hourglass - again good.  But the postback doesn't happen - not good.  I assume that the ASP client code is trying to help by preventing the postback when it sees that the link is disabled.

So, how can I either:

  • Persuade the LinkButton to postback even though it has just been disabled; or
  • [probably better] Get my client code to execute immediately after the postback code rather than before.



Back Button for Parent Report

Hello all, I have created a summary report and have the hyperlink set up to jump to another detail report. In BIDS, when I get to the detail report, there is an option to go back to the parent report. But when I publish these reports to Report Manager, that back button is not there. Does anyone know a workaround to this? I really want the user to be able to go back to the summary report when they are done looking at the details. We are working on SSRS 2005. Any help would be greatly appreciated.

Web Form breaks after using the browser's back button

I have a web form that allows a user to put some data in a textbox and click a button to do a search on that data.  It opens up a Sql Server Reporting Services report using the data they entered on the previous page.  If they use the browser's back button to go back and enter some different criteria to search on, the buttons don't work anymore. Any ideas or suggestions on what would cause this?   Thanks! 

Back & forward button of browser hide...

Hiwithout script can i hide back & forward button of browser ..here lot of solution given but not working properly so please give me solutionthankscraj

Authentication required, redirect to login page

Hi,I want authentication required for all webpages in a site. If i copy the url of any of the web page in the current site and paste it in the url address i should redirect to login page. If you have any solution please suggest it.

Confirmation prompt when click on "save" button?

Currently I am working on SharePoint 2010 project that my customer want something like confirmation prompt, (e.g. upon click on “save” button, system prompts “are you sure you want to save?”) for all following 8 area: ·         Document Repository (meta-data) ·         Calendaring ·         News ·         Task List ·         Quick Links ·         Blogs ·         Wiki ·         Forums   Is this possible?  Has anyone done this or something similar?  Can anyone point me to some examples or best practices when doing this? Thanks Believing is Seeing

Authentication Providers button greyed out. Trying to turn on anonymous access

Please can you assist. I am trying to enable anonymous access. Tutorials point me to: 'Central Admin > Site Actions > Site Settings > Application Management > Manage web applications > Sharepoint - 80' I should then click on 'Authentication Providers'. This button is greyed out. I am running in dev on windows 7 64bit. Thanks.

Lotus Notes users get "Authentication Required" when viewing an alert email with a graphic

(This is a SharePoint 2007 question, but I only see SharePoint 2010 in the Forum options...kind of odd since SharePoint 2010 has not been released.)If our users open email alerts in Lotus Notes, and the email has an image, they are presented with a prompt for credentials that says:"Authentication RequiredEnter your username for Unkown at sharepoint.ourcompany.comUsername________________________Password________________________[ ] Save these in an Account in my address book[OK][Cancel]"Emails without graphics do not prompt for credentials.Does anybody know why this happens, or how we can fix it?

Browser back button issue when ViewState stored in DB.

I implemented the solution of storing the ViewState in DB (since we were getting lots of Invalid & Corrupt Viewstate errors on our site daily) as given in the following website:http://weblogs.asp.net/adweigert/archive/2004/03/09/86628.aspxThe solution was implemented in one of the aspx pages on our site that behaves like a wizard (not using the wizard control though). After starting to store the viewstate in DB, the Invalid ViewState errors were eliminated completely, but I am now facing the following problem:1) User selects radiobutton1 of the two radiobutton choices on Page 2 of the wizard, a postback happens which displays some extra information on the page based on the selection. Now the user hits the next button on the page that also does a postback & displays Page 3.2) On Page 3, user hits the "back button" of the browser instead of the "previous page" button that is available on that page.3) This displays Page 2 from cache in original state(without any selections made). When user now selects radiobutton2, a postback is supposed to happen, but it does not. User then clicks "next" button on Page 2 (a postback does happen here however), & Page 3 is displayed, but it still thinks that radiobutton1 was selected (the original selection that was made in step1) on the previous page & hence displays information accordingly.I am assumi

Mobile redirect and the browser back button

Has anyone here ever successfully constructed a two-page mobile website with VB, one page for input and one page for displaying results?  If so, how do you call the results page and can you return to the input page using the back button on your mobile browser?  I have no problem creating such a website for regular browsers, but I simply cannot construct one for the iPhone or the Droid ... you can't return to the first page via the backbutton and still have it be functional; all you have is the graphics.  There is no load event for the page you're returning to.  It seems like mobile browsers don't handle server-side redirects properly.  If you open a new page via a hyperlink, you can return to the page you were on and it will still be functional; not so following a redirect to another page on your site. I've experimented endlessly with cache settings, redirect parameters, and the pagestatepersister class to no avail.  I need to know if I'm on a futile quest.  Can anyone offer confirmation for can do/can't do?    

report manager parameters , back button do not show

Hi, not sure this is an expected behavior.  My drill through reports have parameters that are passed from the first report.  once drill through, somehow the parameters are not showing in report manager.  also the Back arrow is also missing from the second report.  is this expected?thanks

Gridview in Updatepanel + back button

Hi, I have a updatepanel with a gridview inside, when I navigate to another page and then click back, the gridview is empty.I have tried to google for a solution but havent found any...Does anyone know a solution for this?

Browser Back button

Hello,    Is there any way to know if the post back happen because of the broswer back button. Or I have a reapter control can i use response.redirect on a image to go to another page.Because i am using <a href now but problem is I want to know the previous page , for that i used URLRefferal but it is not getting the right page because it is a <a href not response.redirect.   Thank, 

logout problem(after logout when clicking on back button after logout still opens the previous page

I am using ASP.NET, the web page is abandoning and clear session when a user click logout link but they click the back button and it is still showing the previous page. How can it prevent the previous page after logout?on Logout.aspx load im using this code//=================//        Session.Clear();        Response.Buffer = true;        Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D);        Response.Expires = -1500;        Response.CacheControl = "no-cache";        //----- Second Technique : To Stop Caching of Secure Pages.        Response.Cache.SetCacheability(HttpCacheability.NoCache);        FormsAuthentication.SignOut();        if (Session["UserName"] == null)        {            Response.Redirect("login.aspx");        }       Session.Clear();         Response.Buffer = true;         Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D);         Response.Expires = -1500;         Response.CacheControl = "no-cac

how to disable back button of your browser

i want to know how can i restrict any user to access any webpage after logging out

Required authentication

Hello, Is there a way to remove the message of authentication required each time I want to access a report. Thanks in advance Regards Aya

Clear back button to force a postback

I am using asp.net 3.5 and use master pages for most of the website. I need to make sure that users after they logout are not able to use the back button to see in cache data. Thanks. 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend