PDA

View Full Version : Ext.form.FormPanel and ASP.NET Forms Authentication



Ex_Soft
28 Dec 2010, 1:53 AM
After authentication's cookie has been expired I submit form and get HTTP 302 (http://msdn.microsoft.com/en-us/library/ff647070.aspx#pagexplained0002_aspnetforms). Ext.form.FormPanel's listeners (actioncomplete/actionfailed) and Ext.form.FormPanel.getForm().submit({success/failure}) don't catch this response. An error is occured in ext-all-debug.js (line 8274) (ExtJS ver. 3.3.0). How to catch this response?

Condor
28 Dec 2010, 2:19 AM
You can't catch a HTTP status 302. XmlHttpRequest will automatically follow the redirect and respond with the data from the next page.

You'll have to configure your server to redirect to a page with, e.g. a 403 HTTP status. (401 would be more appropriate, but Firefox incorrectly responds to that by showing the basic login dialog).

Ex_Soft
29 Dec 2010, 3:12 AM
You'll have to configure your server to redirect to a page with, e.g. a 403 HTTP status. (401 would be more appropriate, but Firefox incorrectly responds to that by showing the basic login dialog).
How I can make it? (IIS 6)

Condor
29 Dec 2010, 3:57 AM
No idea. I got it working on WebSphere, but I don't use IIS.

Ex_Soft
29 Dec 2010, 7:57 AM
global.asax.cs


protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
if ((Context.User == null || !Context.User.Identity.IsAuthenticated)
&& Context.Request.Headers["X-Requested-With"] == "XMLHttpRequest")
{
Context.Response.StatusCode = 403;
Context.Response.End();
}
}