Loading ...

Detect the http or https scheme in ASP.NET in server side code | CodeAsp.Net

Detect the http or https scheme in ASP.NET in server side code

 /5
0 (0votes)

To detect the http or https scheme in ASP.NET in server side code we can use Uri.Scheme property.
Below is the sample code to do the same:

        string url = "https://www.yourwebsite.com/";
        Uri uri = new Uri(url);
        string scheme = uri.Scheme;
        Response.Write(scheme);

The output of above code is "https"

Comments (no comments yet)

Top Posts