2012年3月26日月曜日

Response.redirect causing error when used with ajax

Hi Guys,

I hope somebody can help me with my problem, I'm fairly new to ajax.I have a datalist in my app which has a clickable button which directs the user to a subroutine....


1Sub PhotoCommand(ByVal objAs Object,ByVal EAs DataListCommandEventArgs)2Dim CommandAs String = E.CommandName3Dim ArgumentAs String = E.CommandArgument45If Session("UserID")Is Nothing Then6 Response.redirect("index.aspx")7End If8End Sub


This works fine when not in a updatepanel and the updatepanel worksfine without the redirect in it, but when you use the two together andclick the button you get the following error in an alert box.

"Sys.Webforms.PageRequestManagerParserErrorException:The message received from the server could not be parsed. Common causesfor this error are when the response is modified by calls toresponse.write(), response filters, HttpModules or server trace isenabled

Details:Error parsing near'

<!DOCTYPE ht'"

Anyone got any idea why this might be ?

Jon

Hi,

Sorry guys, just found out what the problem was by searching the forum a bit more. FOr the sake of anyone else with the same problem, I had forgotten to add the following to my web.config...

<httpModules>

<addname="ScriptModule"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</httpModules>

0 件のコメント:

コメントを投稿