Sandip's Programming Zen

An attempt to share tech/coding experiences

“Page cannot be displayed” Error on Asp.Net post back

with 8 comments

If you have above error displayed as soon as you do post back on your page while rest of your app is still working then you might have huge viewstate data in your page.

Normally it happens when you are loading a page displaying several hundreds records, that may generate very big viewstate value inside your page. The loading will work fine but as soon as you post back the page it will throw that error. Reason is your page becomes too bulky to be accepted by server.

To solve the problem you obviously have to reduce the side of the viewstate by either disabling viewstate on your page or disable on selected controls where it is not needed, if both of these is not possible then simply reduce the number of records displayed at a time.

Ok, that’s a generic solution but in Asp.Net framework 2.0 you can handle it by using an in-built feature called “Viewstate chunking”, this will chunk out the viewstate data so that not a single large element is generated.

Update: If you are using framework 1.1 then there is an option of in-memory viewstate compression. Check this link for more details ( I have implemented it using vb.net so you can ask me for help).

Advertisements

Written by Sandip

June 6, 2008 at 9:57 am

Posted in .Net

Tagged with

8 Responses

Subscribe to comments with RSS.

  1. During execution of the asp.net program

    http://localhost:1102/Relation%20Based%20Semantic%20Web/Admin_DomainNames.aspx

    The page cannot be displayed – error on I.E. why ? How I solve ?

    Anand

    September 18, 2008 at 8:58 am

  2. First of all make sure that the Page actually exists on the Path and the spelling is correct.

    If everything works fine then check the viewstate size, is it so large?

    Sandip

    September 18, 2008 at 3:42 pm

  3. I tried to embed a video file in html using vb.net. I know the file size should be not more than 4 mb , but how can i intimate the user if he uploads more than 4 mb without seeing the max upload size . when the user select a file say ab.avi which is 5.0 mb the page automatically redirected to page cannot be displayed
    any suggestion to redirect it !

    Regards
    Karthick N
    karthick001@ymail.com

    Karthick

    November 24, 2008 at 5:07 am

  4. Hi Karthick,

    Unfortunately there is no graceful way yet to handle this problem. At max you can put a warning note next to upload control about size limit or simply increase the limit by setting maxRequestLength property in web.config.

    Sandip

    November 24, 2008 at 9:34 am

  5. I have a login page, which checks the database to see of the username and password match the entries on the webpage. The third time the wrong entries are input, on postback, the page displays “Page cannot be refreshed.” Would you know why this happens? I do not have logic written in code to check for three attempts. I have not set any authorization settings in the web.config file also.

    T.S

    May 6, 2009 at 10:52 pm

    • Hi T.S

      Can you paste your code here so that I can see what exactly your code does?

      Sandip

      Sandip

      May 7, 2009 at 5:38 am

  6. Hi Sandip,

    I was wondering about an issue on postback, getting error “Page cannot be displayed”. I found that page is using bulky view state, and solved that problem !

    Thank you

    sibiraj

    July 4, 2011 at 1:29 pm

    • In VS2010 + FW 4, viewstate is disabled by default for all controls , you have option to manually activate it. The situation was reverse in earlier versions and hence the this issue.

      Sandip

      July 4, 2011 at 1:50 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: