Mega Code Archive

 
Categories / ASP.Net Tutorial / ASP Net Instroduction
 

Override string GetVaryByCustomString in Global asax (C#)

<%@ Application Language="C#" %> <script runat="server">     public override string GetVaryByCustomString(HttpContext context, string arg)     {         if (arg.ToLower() == "prefs ")         {             HttpCookie cookie = context.Request.Cookies["Language"];             if (cookie != null)             {                 return cookie.Value;             }         }         return base.GetVaryByCustomString(context, arg);     }     void Application_Start(object sender, EventArgs e)      {         // Code that runs on application startup     }          void Application_End(object sender, EventArgs e)      {         //  Code that runs on application shutdown     }              void Application_Error(object sender, EventArgs e)      {          // Code that runs when an unhandled error occurs     }     void Session_Start(object sender, EventArgs e)      {         // Code that runs when a new session is started     }     void Session_End(object sender, EventArgs e)      {     }         </script>