asp.netauthenticationhttp-redirecthtml5-appcache

Redirect user to html page from asp login control when no internet connection


I am using the application cache to save pages offline and have set a FALLBACK: so that, if the user accesses any page on my site which isn't in the appcache, they are redirected to Home.html. The only point at which this doesn't work is if the user has the Login.aspx page open before they lose connection. If they then select the login button they are sent to the standard 'There is no internet connection' page rather than my Home.html page.

Can I get the login button to send the user to my Home.html page when they have no internet connection? I am using a standard asp login control on my login page. I tried setting the following in system.web in my web.config file:

 <customErrors defaultRedirect="Home.html" mode="On">
 </customErrors>

but that seemed to have no effect. Does anyone know of a way I can do this?


Solution

  • You cannot use Application Cache to support fallback behavior for the login control. The login control issues an HTTP POST, and only HTTP GET is supported.

    You could write your own login page that uses a GET, but that means the user name and password would show up in the URL, which is not a very good idea, even over HTTPS.

    Perhaps you could issue the login request within an iFrame, or using AJAX, and use Javascript to navigate to the fallback page if it fails.

    By the way, application cache support has been deprecated, so maybe you should move away from this solution.