0

I am work a site that was coded in c# and uses a ssl cert "secure.mydomain.com To switch from http to https it uses the following code

       if (useSsl)
        {
            if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["SharedSSL"]))
            {
                //shared SSL
                result = ConfigurationManager.AppSettings["SharedSSL"];
            }
            else
            {
                //SSL
               **result = result.Replace("http:/", "https://");**
            }

This will switch from "http://mydoman.com" to "https://mydomain.com", but I need "https://secure.mydomin.com". If I change the code to result = result.Replace("http:/", "https://secure"); it takes me to an error page because it is trying to go to "https://secure".

I have been searching for 3 weeks to find a solution and tried so of them but none worked. Any suggestions on how to correct this?

2 Answers 2

3

You have missed the extra forward slash on your http

result.Replace("http://", "https://secure.");

This will work for you hopefully

Sign up to request clarification or add additional context in comments.

Comments

0

As stated by soniic, you've missed a /.

This means your string will look like

https://secure/.mydomain.com

Thats why you're being redirected to https://secure instead of https://secure.mydomain.com

2 Comments

I wish to thank you for you prompt help. Do not know if it worked another problem developed. When I click on a link that takes me to a secure page it is giving an error that says "The connection was reset. The connection to the server was reset while the page was loading." The url in the address bar is correct because it states "secure.mydomain.com" What is the best way to track this down?
Does visiting that url normally (by typing it in the address bar) result in the same error?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.