PDA

View Full Version : [CLOSED] Handling session for a EXT.NET Grid Panel ajax Call



PriceRightHTML5team
Jul 24, 2013, 12:32 PM
Hi Ext.NET Team,

I have created a custom action filter for handling session expiration.
Inside that filter I have checked whether session is null if yes i am redirecting it to the login page
Below is the action filter code snippet:


if (HttpContext.Session["PRUserDetails"] == null)
{
HttpContext.Response.Redirect("~/Account/LogOut");

return;

}

Issue is when i am placing that filter to an ajax call to load the grid panel.
It do redirect to the login page but inside a window below is the method where i have placed the filter:


[SessionExpireFilter]
public StoreResult LoadGrid()
{
...
return this.Store(Model)
}


In the attachment the login page comes inside the window.

Any suggestion on how to resolve this.


6611

Daniil
Jul 24, 2013, 4:29 PM
Hi @PriceRightHTML5team,

An AjaxProxy doesn't support a redirection response. You can listen its Exception (or a Store's Exception) event analyzing a response within a handler. If there is a redirection, then redirect the page client side via

window.location = "new URL";

PriceRightHTML5team
Jul 25, 2013, 5:46 AM
Hi @PriceRightHTML5team,

An AjaxProxy doesn't support a redirection response. You can listen its Exception (or a Store's Exception) event analyzing a response within a handler. If there is a redirection, then redirect the page client side via

window.location = "new URL";


But how does the store's exception handler is raised.I added following code to the grid's store:


X.Store().Listeners(l => l.Exception.Handler = "Error")

and in my controller i am doing :


public StoreResult GetList(string Id)
{
try
{
var dto = GetUserCredentials();
if (dto == null)
{
throw new Exception();
}
}

but the exception handler is not getting raised. Can you please provide a scenario on how to raise that handler

Daniil
Jul 25, 2013, 5:54 AM
Please try

X.Store().Listeners(l => l.Exception.Handler = "Error()")
or

X.Store().Listeners(l => l.Exception.Fn= "Error")


The difference between Fn and Handler is explained here.
http://www.ext.net/2012/12/19/introduction-to-ext-net-events/

PriceRightHTML5team
Jul 25, 2013, 6:49 AM
Please try

X.Store().Listeners(l => l.Exception.Handler = "Error()")
or

X.Store().Listeners(l => l.Exception.Fn= "Error")


The difference between Fn and Handler is explained here.
http://www.ext.net/2012/12/19/introduction-to-ext-net-events/

Thanks Daniil it worked