To access a secure page that uses https is a little bit different. T
o access a https page in your web application you need to pass the absolute url of the page. So instead of adding that url to every page that request a secure page you can use the "
AppPath " property of the
<appSettings> in the web.config file. Just change you web. config file and add the following code to it.
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="AppPath" value="//localhost/Retinaa/"/>
</appSettings>
...............
Here "//localhost/MyApp/" is the common path for every page.
Then you have to retrieve the application path from the web.config file. When any page want to access a secure page you have to use the following code,
string url = "https:" + ConfigurationManager.AppSettings["AppPath"] + "Login.aspx";
Response.Redirect(url);
It will pass the complete url to the Redirect() method. Here Login.aspx is the secure page i want to access.
Similarly if you want to access an unsecure connection(http) from any secure page use the following code while requesting that page,
string url = "http:" + ConfigurationManager.AppSettings["AppPath"] + "Home.aspx";
Response.Redirect(url);