<%@ Application Language="C#" %> <script runat="server"> //Added by Alex on Jan 29,2014 to clear http/https issue without enabling SSL Certificate private void RedirectToCorrectSSLScheme() { Uri pageRequest = Request.Url; string requestPath = pageRequest.GetLeftPart(UriPartial.Path).ToLower(); requestPath = Server.UrlDecode(requestPath); // PageIsSecure returns if the given page should be secure or not. I //maintain a list of secure pages or //secure directory in an XML config. // bool securePage = GetSecurePages().PageIsSecure(requestPath); //Instead of localhost we can set the IP Address of Qatar server if (pageRequest.Scheme == "https" && pageRequest.Host.Contains("localhost") && requestPath.Contains(".aspx")) { Response.Redirect("http://" + pageRequest.Host + pageRequest.PathAndQuery, true); // Response.Redirect(requestPath, true); } //Added by Alex to check external url of qatar server //Instead of localhost we can set the IP Address of Qatar server if (pageRequest.Scheme == "http" && pageRequest.Host.ToString()!="localhost" && requestPath.Contains(".aspx")) { Response.Redirect("https://" + pageRequest.Host + pageRequest.PathAndQuery, true); //Response.Redirect(requestPath, true); } } void Application_BeginRequest(object sender, EventArgs e) { //Function Added by Alex on Jan 29,2014 to clear http/https issue under Qatar Server RedirectToCorrectSSLScheme(); } 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) { // Code that runs when a session ends. // Note: The Session_End event is raised only when the sessionstate mode // is set to InProc in the Web.config file. If session mode is set to StateServer // or SQLServer, the event is not raised. } </script>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)