Authenticating HTML files using Asp.net and MVC

Coding: 
  1. if (Request.RawUrl.ToLower().EndsWith(".html"))  
  2. {  
  3.    if (Request.Cookies[".ASPXAUTH"] != null)  
  4.    {  
  5.       string value = Request.Cookies[".ASPXAUTH"].Value;  
  6.       if (value == null || value == "")  
  7.       {  
  8.          Response.Redirect("~/Account/LogOn");  
  9.       }  
  10.    }  
  11.    else  
  12.    {  
  13.       Response.Redirect("~/Account/LogOn");  
  14.    }  
  15. }  
Here  .ASPXAUTH is the Form Authentication Cookies and Account is the Controller and LogOn is the actionand also add below coding in webconfig section: 
  1. <buildProviders>  
  2.    <add extension=".html" type="System.Web.Compilation.PageBuildProvider" />  
  3.    <add extension=".htm" type="System.Web.Compilation.PageBuildProvider" />  
  4. </buildProviders>  
  5.    
  6. <handlers>  
  7.    <add name="HTML" path="*.html" verb="GET, HEAD, POST, DEBUG" type="System.Web.UI.PageHandlerFactory" resourceT
  8.    ype="Unspecified" requireAccess="Script" />  
  9.    <add name="HTM" path="*.htm" verb="GET, HEAD, POST, DEBUG" type="System.Web.UI.PageHandlerFactory" resourceTyp
  10.    e="Unspecified" requireAccess="Script" />  
  11. </handlers>