By default IIS 7 will generate a new session when accessing a site over a secure HTTPS connection. This can cause issues if you are switching between a HTTP and a HTTPS connection when dealing with a site that handles logged in users via sessions.
Luckily this is a easy fix.
Open up the Internet Information Services (IIS) Manager, and select the web site you wish to change the setting on:
Open up the “ASP” feature:
Expand the “Session Properties” section:
Change the drop down option for “New ID ON Secure Connection” from “True” to “False”.
Restart the web site to make sure the settings take effect.
This guide shows you how to restart a specific IIS 7 web site from the command line. This can come in very handy if you need to automate restarting the site.
IIS 7 includes a command line management tool called “appcmd.exe” which allows you do do a wide range of tasks, including stopping and starting specific websites.
The “appcmd.exe” program isn’t in the ‘PATH’ environment variable, so you must run it from within the correct folder, or add the folder to your PATH environment variable.
Open a command window by clicking the start button, and typing cmd.exe into the search and hitting enter.
(or by pressing the WINDOWS KEY + r combination on the keyboard, and typing cmd.exe”, and clicking “OK”)
Change to the C drive, or whatever drive your OS/Windows folder is installed on:
C:
Change directory to the location where appcmd.exe resides (c:\windows\system32\inetsrv\):
cd %WINDIR%\system32\inetsrv
Issue the following command to view the web sites available on the server:
appcmd.exe list site
You should get something like the following returned on the screen:
SITE "Default Web Site" (id:1,bindings:http/*:80:,net.tcp/808:*,net.pipe/*,net.m smq/localhost,msmq.formatname/localhost,https/:443:,http/127.0.0.1:80:,https/127 .0.0.1:443:,state:Started)
The main part of this we need to take note of is the site name, which in this case is “Default Web Site”.
Run the following command to stop the specified website, using the above site name to reference what site you want to stop:
appcmd.exe stop site /site.name:"Default Web Site"
To start the site back up, run the following command:
appcmd.exe start site /site.name:"Default Web Site"
The web site should now be started again.
The whole process should look like this:
Note: You can always reference the appcmd.exe file directly, instead of changing directories first, using the following path:
%WINDIR%\system32\inetsrv\appcmd.exe