I am trying to get the path of the current website and I am doing this to get the url.
Uri uri = HttpContext.Current.Request.Url;
string callbackUrl = uri.Scheme + "://" + uri.Host + (uri.IsDefaultPort ? "" : ":" + uri.Port) + "/Work";
It works fine on development server, but does not work in production which is a https site.
uri.Scheme gives me http. What am I doing wrong here. Is there a way that uri.Scheme returns https instead of http when this code is called from a https site.
Thanks
IIS does some filtering that affects Request.Url for https requests. Ended up doing some Googling and it seems like there are a few limitations. You might have to come up with a custom solution based on this blog post.
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