Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET - Check for development machine or server

I have a https site which i am working on. The development machine would not support https and thus give me error. Is there any way to recognize that https will work for the current environment or not. My application sends out a email in which it replaces http with https. I want to place a check on that.

like image 262
Ankit Avatar asked Jun 08 '26 04:06

Ankit


2 Answers

if(Request.IsLocal)

this returns Gets a value indicating whether the request is from the local computer.

and

if(Request.IsSecureConnection)

this returns Gets a value indicating whether the HTTP connection uses secure socckets (this is, HTTPS).

like image 78
Muhammad Akhtar Avatar answered Jun 10 '26 05:06

Muhammad Akhtar


You could infact install a self-signed certificate on your development machine. The browser will throw a wobbly until you accept it as an exception, but it does allow you to test your site/application in both HTTP and HTTPS scenarios.

like image 29
Matthew Abbott Avatar answered Jun 10 '26 04:06

Matthew Abbott