asp.net ScriptManager EnableHistory="true" InvalidOperationException - asp.net

I manage ajax browser history using asp.net's(v. 4.0) EnableHistory="true" of the ScriptManager & everything has worked fine till today.
I fire my browser from localhost today and I get this error message in IE 9 (only IE)
Message:
Sys.InvalidOperationException: For the
history feature to work in IE, the
page must have an iFrame element with
id '__historyFrame' pointed to a page
that gets its title from the 'title'
query string parameter and calls
Sys.Application._onIFrameLoad() on the
parent window. This can be done by
setting EnableHistory to true on
ScriptManager.
I've undone all modifications I made today, cleared my browser cache+cookies+history+everything and deleted "Temporary ASP.NET Files" both from the Windows and Temp folders but this error wont go away.
Deleting <meta http-equiv="X-UA-Compatible" content="IE=7" /> from my master page however gets rid of the error but its not an option as a lot of styling goes wrong. The meta has been there from the start and everything has worked so my question is why now?
Any pointers to further reset my environment(e.g deleting some hidden files) or some light into what might be going on will be helpfull.
Thanx.

The ScriptManager outputs an iframe to make history management work correctly in IE7. In this case, unfortunately, there is a bug. Your browser is IE9, so it figures you don't need the iframe. But your meta tag makes the client-side behave as IE7, so it does need the iframe. It will be fixed in the next rev of .NET. Until then, you should be able to work around the problem by looking at the iframe content that is rendered when you use compat mode, or an actual IE7, and mimicking that in your page. But you need to make sure it doesn't end up in the page twice when it really is IE7, so only output it if you detect IE >= 8. Make sense, I hope? :)

Related

Annoying Page Jumping on Postback

I am having a really annoying issue where the page visibly jumps to the top and then to the previous scroll position on a postback.
Some details: I have an ASP.NET (VS 2010, .Net Framework 4.0) page that is using a set of RadioButtons in a RadioButtonList to display and hide a couple of Panels depending on which RadioButton is selected. There are also a couple of other controls on the page that cause the page to post back to the server. I have the MaintainScrollPositionOnPostback page attribute set to "true".
Functionally all of this works fine. The problem is visually the page jumps to the top when reloaded and then jumps down to the previous scroll position. But only in some browsers. I have tested this on my development machine using IE 9, Chrome and Firefox. My boss is testing it only in IE 9. On my development machine it works perfectly in IE 9 (oddly enough) but not in Chrome or Firefox. In IE the page sits there as it looked before the post back and then simply displays or hides the panel maintaining the previous scroll position the entire time. Looks great. In Chrome and Firefox, when the page reloads, it jumps to the top of the page and then jumps down to the previous scroll position and is really annoying to observe. The kicker is, on my bosses machine, she is also using IE 9. In fact it is the exact same version I am running but on her machine she is seeing the the same behavior that I am seeing in Chrome and Firefox.
I have tried adding the following meta tags, in every combination conceivable, but they have not done anything to help solve this issue.
<meta http-equiv="Page-Enter" content="Alpha(opacity=100)" />
<meta http-equiv="Page-Exit" content="Alpha(opacity=100)" />
Am I going to need to re-architect this page to use an UpdatePanel to resolve this issue or is there another way? What am I missing here?
Well . . . This is not really the answer but I solved the issue bu adding some Update Panels to the page and it works great.
I'm still curious about the issue and if someone would like to weigh in on it I'll continue to monitor this post to see what you have to say about it.
You should consider taking advatage of a JavaScript workaround that leverages the __LASTFOCUS hidden field. It is documented in this CodeProject article:
http://www.codeproject.com/Articles/17571/Maintain-focus-between-postbacks-in-ASP-NET-al

ASP.NET page running on compatibility view and displays badly

I'm developing a website that displays fine in FF or Chrome, but when running on IE, it displays the message below and turn view into compatibility, thus the layout fails to display correctly and some tags and controls such asp menu disappear (still exist in html code).
Can anyone help me solve this problem?
Error Message: A problem displaying localhost caused internet explorer to refresh the page using compatibility view!
There are most likely markup validation errors in your page that is causing IE to fall back to compatibility mode that FF or Chrome may ignore. Ensure that your page passes validation.
Try going here W3C Markup Validation Service and running your HTML or URL through to look for any blatant errors.
The other possibility is that you are explicitly setting the meta tag for IE to force compatibility, e.g.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
If so, remove it.

ASP.Net FileUpload control causes google chrome to crash and show broken data

I am working on an asp.net page that contains a fileupload server control (not async fileupload).
I recently noticed that whenever that control is on the page and any postback occurs, the page crashes and stops executing..giving me strange and broken data like in the screenshot attached!!
I also noticed that is happening in any webkit based browser (e.g safari, chrome, etc..)
Strangely, the problem is only occurring when am running this page online, but when am debugging it locally, this problem doesn't occur!!
Any ideas??
Note: The following link [ http://i.stack.imgur.com/lpe24.png ] is a screen of how the crash looks like, and i remember something now, i used to get this screen sometimes while am browsing through google.com or images.google.com !! hope this helps :S
Turns out this whole problem was caused by the compression module referenced in the web.config file.
As a permanent solution however, I changed all FileUpload controls to AsyncFileUpload, gaining both a solution and an easier way to navigate and work.
Thanks everyone ;)

Site working in FF not in IE, Built with iframes

I have a site, that i built through iframes, but i cant seem to use it with IE.
For safety resons i cannot give access to it, but ill explain wehat the problem is.
First of all i was forced to do it through iframes due to the webserver didnt support .net.
Heres how it looks:
http://ipdg.se/order.htm
So far so good, an iframe working good. But when i try to log in the problem starts.
If FF it goes smoothly, but in ie, it doesnt happen anything(Would normally be redirect to the same page but with session variables and showing other content) i dont know what causes this. but either IE cannot do response.redirects, or there is a problems with the iframe.. or both.
It works in alla major browsers except for internet explorer!
Some time back there was a problem like this... the iframe tag was
<Iframe src="order.php" width="450" height="650"></Iframe>
The solution was to change the src from order.php to order.html... That may not be possible in your case, but it appeared that there was an IE security setting that prohibited the dynamic page from loading.
As a previous poster said. the problem is with IE and its security check, therefore. Using server.transfer got it working.
response.redirect doesnt redirect directly to the page, it communicates with the client browser before the redirect. therefore the browser has a chance to stop the request(Lame IE).
but server.transfer doesnt do that and goes around the problem.

How to prevent page refreshes on tab switching in IE7?

For a specific website (internal to network, coded in XHTML) the behavior in IE6 was that when ever the window is re-sized or restored the page refreshes.
Since IE6 doesn't have tabs I upgraded to IE7 - but the problem with IE7 is whenever we switch from one tab to another, its makes the active tab's page to refresh, and this happens all the time.
After googling a bit, I found a temporary solution, (to disable the Meta-Refresh property in IE settings). This has resolved the problem to some extent but still refreshes happens.
Is there a way to permanently disable the refreshing of page when tabs are switched ?
In my opinion your solution is to use something along the lines of:
<!--[if IE #]>
Special instructions for IE # here
Rather than on restored just leave your code to refresh in resize.
Depending on what your page is doing you most likely may not need it to
refresh on resize using IE8+.
<![endif]-->
Otherwise I would just plan on the IE8+ being the used browser and not worry about what it does in IE6 anymore.

Resources