Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Steps to convert your http page to https:

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 ";


------------------------------------

[link=http://www.clickssl.com]http:www.clickssl.com[/link]

Sign In or Register to comment.