asp.net mvc 2 - How can I tell whether a controller action was requested by DNS or IP? -
on webdev server, i'm trying test whether controller's action requested through raw ip, or dns. i've tried looking @ controller's httprequest.url.hostnametype
, seems resolve dns if enter local ip in browser. ideas? in advance.
that information passed in host
header of http request, should able access this:
var requestedhost = request.headers["host"];
if request ip address, ip address string should returned. otherwise, whatever hostname used.
Comments
Post a Comment