HTML & WEB-Design

Moderators: Jonathan
Number of threads: 1214
Number of posts: 3288

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Steps to convert your http page to https: Posted by seo4ssl on 22 Jan 2010 at 10:27 PM
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




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.