Use the following code in your index or home page of application.
string strURL = Request.Url.ToString();
Array arrURL = strURL.Split('/');
string strHttpPath;
string strHttpsPath;
Array arrHttpPath;
strHttpPath = "http://" + arrURL.GetValue(2).ToString() + Request.ApplicationPath;
strHttpsPath = "https://" + arrURL.GetValue(2).ToString() + Request.ApplicationPath;
arrHttpPath = strHttpPath.ToCharArray();
if (arrHttpPath.GetValue(strHttpPath.Length - 1).ToString() == "/")
{
strHttpPath = strHttpPath.Substring(0, strHttpPath.Length - 1);
strHttpsPath = strHttpsPath.Substring(0, strHttpsPath.Length - 1);
}
//Session["HttpPath"] = strHttpPath; //When http path is required uncomment it and use this session value while redirecting it to other page.
Session["HttpsPath"] = strHttpsPath;
Now use Response.Redirect method in following way.
Code
Response.Redirect(Session["HttpsPath"].ToString() + "/Contents/ThankYou.aspx");
Note: My Thankyou page is located inside Contents folder.
Incase of using javascript to redirect the page, follow the below code
location.href = '<%=Session["HttpsPath"].ToString()%>' + "/Contents/ ThankYou.aspx ";
------------------------------------
http:www.clickssl.com