ASP.NET MVC – Prevent Browser Back Button Openning Page After Logout

If you have ASP.NET MVC application with login / logout functionality (for example using Forms Authentication), you may have noticed that after logout, if you hit back button in your browser, last page you were on will open. In secure application this could present a problem, as it could expose information that only authorized users should view.

Culprit in this scenario is our browser, as it will quite happily show cached version of the page after you’ve logged out.

There isn’t much you can do, except tell your browser to not cache your application’s pages. You can do this for individual pages in your applications, or if you want all pages not to be cached, you can add an event in Global.asax file.

Add Application_BeginRequest() method to your application’s Global.asax file, and add code below which will disable browser caching for each request.

        protected void Application_BeginRequest()
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
            Response.Cache.SetNoStore();
        }
Advertisements

How to Force Refresh iOS App Store

If you wish to refresh iOS App Store, you can either force close and re-open it, or you could force refresh content right from the App Store itself.

To force refresh App Store, tap 10 times on one of the options at the bottom – Featured, Top Charts, Explore, Search or Updates. Make sure you pick one option and tap on it 10 times (e.g. tap 10 times on Updates), rather than tap on different options.

Once you’ve tapped 10 times, App Store content will reload, along with any updates as well.

 

App Store

Visual Studio – Enable Debug for new Build Configuration

When you are setting up new build configuration which you want to be able to debug, you need to set Debug info to Full.

Right click the project in Solution Explorer and select Properties. Select build tab and then select desired configuration from Configuration drop down list at the top of the page.

Click on Advanced at the bottom of output section and select Full from Debug Info drop down list.

Save changes to project settings and rebuild your solution.

VSBuildConfigDebug

Font Awesome and IIS

If you are using Font Awesome in your ASP.Net web app which is hosted on IIS, you need to set appropriate mime type for Font Awesome files, otherwise IIS won’t know how to serve them.

To do this, you’ll need to add mime type mapping to <system.webServer> section in your application’s Web.config file.

Before registering each file extension (woff and woff2), we’ll want to remove them first, just in case that mime types for those are already registered on IIS host.

<system.webServer>
<staticContent>
<remove fileExtension=”.woff” />
<mimeMap fileExtension=”.woff” mimeType=”application/x-font-woff” />
<remove fileExtension=”.woff2″ />
<mimeMap fileExtension=”.woff2″ mimeType=”application/x-font-woff2″ />
</staticContent>
</system.webServer>

How to Hard Reset HP Laptop

Doing a Hard Reset (or Forced Reset) on HP laptop to clear and then set up again connections between BIOS and the hardware. You can use this to resolve a range of issues, such as boot issues, Windows not loading properly, or software freezing when you use it.

To do a hard reset, perform the following steps:

  1. Turn off you laptop.
  2. Disconnect power and anything else you might have connected (e.g. printer, USB hard drive, mouse).
  3. Remove the battery.
  4. Press and hold Power button for 30 seconds.

Once you’ve done all this, re-insert the battery and power up your laptop.