public static string ChangeUriToHttps(HttpRequest request)
{
string uri = request.Url.AbsoluteUri;
if (!IsRequestSecure(request))
uri.Replace("http", "https");
return uri;
}
If I send in a request that has a uri like this:
http://localhost/AppName/somepage.aspx
it doesn't replace the http with https.
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With