What a weird title for a solution that I don’t think many people would need 🙂 But apparently I needed it. So after scratching my head for non-dandruff-related cause, I found out how to do it.
Just a short background story. We have ASP.NET MVC application already deployed in the production server. Unfortunately, the launch date of the application is still days ahead. So instead of showing the application, a countdown page is more appropriate.
So somebody come up with the countdown page. Sadly, it was in PHP. It was a quite challenge to make IIS serve the index.php. I tried set the IIS’ default document priority, but it didn’t work.
Then I realized that Global.asax is overriding IIS behavior. Since the index.php needs a few .js files, .css and few .png images, I amended the Global.asax.cs into something like this:
protected void Application_AuthenticateRequest(object sender, System.EventArgs e) { string url = HttpContext.Current.Request.RawUrl.ToLower(); if (!(url.EndsWith("index.php") || url.EndsWith(".js") || url.EndsWith(".css") || url.EndsWith(".png"))) { Response.Redirect("http://www.project.com/index.php", true); } //..... //Your exisiting code //.... }
To deploy this solution, first I recompile the project. Then I backup my original dll by renaming it into .bak file. Lastly, I copied the newly compiled dll into the Server’s bin folder.
This way, it would be a minor change on the launch date D-Day. I could simply delete the application’s main dll file, and rename the existing .bak file into .dll.
I hope it helps. Cheers!
loading...
About Hardono
Incoming Search
asp.net, mvc