Monday, 12 August 2013

ASMX script service returns 401 basic when using forms authentication and bad auth ticket

ASMX script service returns 401 basic when using forms authentication and
bad auth ticket

I have an asp.net 4.0 application that contains a web service that is used
to render some data through ajax. I have the service attached to my
scriptmanager through a script reference. My site is protected by forms
authentication.
<ajaxtoolkit:toolkitscriptmanager id="ScriptManager1" runat="server"
enableviewstate="false"
asyncpostbacktimeout="3600" scriptmode="Auto"
enablepagemethods="true" CombineScripts="true"
EnableCdn="true" >
<Services>
<asp:ServiceReference
Path="~/WebServices/PortalWebService.asmx" />
</Services>
</ajaxtoolkit:toolkitscriptmanager>
When i try and call the webservice method using javascript and my auth
ticket is still valid everything is hunky dory and i get my response back
perfectly fine. But if my auth ticket is expired when the javascript call
is made then the server pops up a window asking for me to authenticate.
The server is responding with a 401 request for basic authentication!

I've attached an on error handler to my service method call and it is
fired after the user has been prompted for a window that doesn't work. How
do i fix this?

No comments:

Post a Comment