My current website runs only in Chrome browser, to do this I have checked in following way
if (Request.Browser.Browser == "Chrome")
{
// Allow
}
But for Edge as well it is returning as "Chrome"
only.
How can I allow access from only Chrome browser?
You can check user-agent and see whether it is Microsoft Edge or not because Microsoft Edge contains Edge/version
in it's user-agent string.
//get user agent somehow here based on what you are working on
userAgent = Request.UserAgent;
if (userAgent.IndexOf("Edge") > -1)
{
// maybe client's browser is Microsoft Edge
}
sample of Edge user-agent strings
Mozilla/5.0 (X11; CrOS x86_64 6783.1.0) AppleWebKit/537.36 (KHTML, like Gecko) Edge/12.0
At the end I suggest to use feature detection on browser instead of acting based on user-agent.