ASP.NET MVC 5 Razor Forms Authentication LoginURL

788 views Asked by At

Apologies in advance if I can't explain this very clearly.

I am using forms authentication in my MVC Razor application. I have the following in my Web.Config:

<forms loginUrl="~/Login/Index" timeout="1" />

Techincally this works fine. The issue I am having is that my application is split into a Header.cshtml that never changes, and then a content area that changes based on the button clicked in the header. If the session has timed out the application writes the Login.cshtml to the content area, instead of the whole page.

In my WebForms application with frames simply adding the following to the login page:

if (parent.frames.length > 0) {
    parent.location.href = self.document.location;
}

took care of the issue. Does anyone know what the equivalent of this is for MVC? I understand there is no parent to set the location of so I am kind of stuck.

Thanks!

0

There are 0 answers