Showing posts with label common. Show all posts
Showing posts with label common. Show all posts

Wednesday, March 28, 2012

How do I intercept Authentication Failed exception from web-service call

Will somebody please put me out of my misery. I think this might be a common problem, but I've spent 30mins searching the forum and I can't find a solution...

I have forms-authenticated web app with a page that makes AJAX client-side calls to a web-service that is part of the same application and hence (I assume) is protected by the forms authentication. The problem occurs when the forms authentication ticket has expired. If a user action invokes a call to the web-service they get a message box quoting InvalidOperationException and Authentication Failed etc. I want to try and intercept this exception and re-direct to the login page as usual. I can't see how to do this. I've tried adding a <location> tag to the web.config to exclude the web-service asmx file from the authorisation, but this doesn't work.

The HTTP logs show a 500 internal server error along with this message:

"@dotnet.itags.org._Error(false,"Authentication failed.",null,"System.InvalidOperationException")Error_@dotnet.itags.org."

How can I intercept this exception??

I'll simplify my question:

How do you chaps manage to make AJAX web-service calls co-exist with forms authentication?

If the authentication ticket expires, how do you handle this error from the client (browser)?

I await your prompt and courteous replies!


OK, so I didn't realise you can specifiy a failure callback as well as a success callback when calling a web-service.

That's all I needed, thanks to no-one for helpingIndifferent

Monday, March 26, 2012

How do I deploy an AJAX Toolkit web app?

This seems like a pretty common thing to want to do, yet I can't find anything (clear) in the documentation or various forums. Simply put, how do I deploy an AJAX enabled ASP.NET 2.0 application?

I can get the files on the server no problem, but what do I need to install on the server to get the AJAX 1.0 code to work? I assume I just need to install AJAX 1.0 on the server, and everything should be fine, right? If so, then why isn't my AJAX code working. If not, then what am I missing?

Note, I'm using the CascadingDropDown control. It works fine on my development computer, but I get the following message when trying to run it on our web server:

AjaxControlToolkit.CascadingDropDown missing required Category property value for CascadingDropDown1.
Parameter name: Category

The category parameter is being set, so I don't understand what the error is.

Any help is much appreciated.

Hi...

and welcome to ASP.NET Forums!

I have an article on cascading dropdownlist. Check this linkhttp://www.aspalliance.com/1183

You also need to make sure, the parameter names should be the same (case-sensitive) as defined in the docs.

Thanks