Sunday, March 11, 2012

AJAX 1.0 - Server showing new events in log..

hello.

if i recall correctly, what happens is that the scriptmanager control generates that exception during the prerender phase of the page life cycle. if you have a default error page and have the web.config correctly set up, the users should be redirecting to tha page...


Seems a shame that just because the page cant show AJAX content it creates an exception. Would it not be a "nicer" experience for the user for the page to show a message saying that a newer browser is required to enable correct viewing. Perhaps in the space where the update panel control should be.

hello again.

well, nothing prevents you from doing that. for instance, you can:

1. have an error page that says just that

2. handle the error generated by the page and redirect the user to a page with that info

3. instead of catching the error, you can refactor your page so that the AJAX portion stays in an usercontrol. then, you could get the current version of the browser before loading the user control; if it doesn't support ajax, then show a friendly user message to the user instead of loading the control

just some ideas...


Hi Luis

Thanks for your reply and suggestions.

I'm no expert in ASP.net so would be most grateful if you could expland a little on your suggestions:

1. An error page that relays a message based on this particular exception would be good. I currently have an error page that I could amend to include this message. However I'm unsure as to how to get at the exception from my error page to ascertain that the exception is this particluar one.

2. To handle the exception within the actual page I would need to use a "Try.. Catch" block (I assume). As the control is created declaratively within the .aspx page how do I handle the error?

3. This is perhaps the best suggestion. How do I get the current version of the browser and check that it supports the DOM Level 1. Its a shame that the AJAX framework does not make this check automatically.

Regards
Stephen


Hi everyone,

In the upcoming RC that exception will be gone and instead of it we'll just fall back to regular postbacks (i.e. EnablePartialRendering=false). There will also be a way to override the behavior if you want to force partial rendering to be on or off in a given request.

However, I do have a question: What user agent is making the request when you see that error in the event log? We're getting the values from browser caps and I want to make sure we're using good values.

Thanks,

Eilon


Hi Eilon

Thanks for your reply. What do I do in the meantime (until RC1) to stop the exception being thrown (or deal with the exception in a simple way)?

Also, how do I ascertain the user agent that has caused the exception? The user agent is not given in the Event log so I need to catch the exception and get the information within my code.

Stephen


Adding the following code to the page init routine seems to have fixed the problem:

If Request.Browser.Crawler = True OrRequest.Browser.W3CDomVersion.ToString() <> "1.0" OrRequest.Browser.Type.ToString.Contains("Opera") Then
s1.EnablePartialRendering = False
Else
s1.EnablePartialRendering = True
End If

I added the Opera part of the statement as AJAX does not seem to work on the Opera browser.

hello.

if i'm not wrong, opera will be partially supported.


Hi Luis

Yes I think you are right. However I'm getting the following error when viewing my AJAX enabled page in Opera 9:

"Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed."


Opera is not supported at all in the beta. However we plan to support it in the upcoming RC. The problem right now is actually a bug in Opera where you can't set the Pragma header, which we rely on for partial rendering, so we'll probably have to find a workaround. I've reported the bug to Opera but we can't really wait for it to be fixed.

Thanks,

Eilon


Hi

I am using ajax beta 1.0, the error still there, all the client agent are spiders, for browsers like firefox or ie, it's fine, but if all the spiders can not work correctly then it still is a big problem coz my site will not be indexed by the search engine.

any suggesed solution from microsoft?

~Mike


g-spot-web:

Adding the following code to the page init routine seems to have fixed the problem:

If Request.Browser.Crawler = True OrRequest.Browser.W3CDomVersion.ToString() <> "1.0" OrRequest.Browser.Type.ToString.Contains("Opera") Then
s1.EnablePartialRendering = False
Else
s1.EnablePartialRendering = True
End If

I added the Opera part of the statement as AJAX does not seem to work on the Opera browser.

I tried this way, but still doesn't work.



beta 2 has this bug?

In Beta 2 at least, there is a new method in the ScriptManager that you can use to determine if the SCM actually sees the request client as being combatible and able to handle ajax requests. Its covered in the migration docs I do believe...The combination of the afore mentioned technigues and the new method should do the trick...

SM.SupportsPartialRendering (boolean)


No comments:

Post a Comment