String replace not working [duplicate]

Solution 1:

common mistake. Strings are immutable. This means the original object can't be modified.

 public static string ChangeUriToHttps(HttpRequest request)
 {
      string uri = request.Url.AbsoluteUri;

      if (!IsRequestSecure(request))
          uri = uri.Replace("http", "https");

      return uri;
 }