問題描述
根據網絡連接將用戶引導到不同的頁面 (Direct user to different page based on network connection)
I am currently working on upgrading an existing asp.net web application. It is being hosted on our local web server and I would like to direct users to a different page if they are connecting locally.
Example: An employee connecting on our local network would be directed to page A. If someone on an outside network connects (presumably a customer) they would be directed to page B. Is this possible? Does the web server know if the connection is local or not? If so, I should be able to code for it. Any help or suggestions would be appreciated.
‑‑‑‑‑
參考解法
方法 1:
We've had an embarrassingly awful hack in place for this kind of situation for years. And while I'm sure there's a better way, what do do is look at the System.Web.HttpContext.Current.Request.UserHostAddress
and if it matches a list we go to one page, otherwise we go another.