Is there a way to show a control on a page ONLY if the page was requested over the local network?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, use
Request.IsLocalproperty, it gets a value indicating whether the request is from the local computer. E.g.EDIT: the answer I provided above is works for a local host only:
To fully answer your question, the subnet mask for the network should be known.
You also may use IP address extension methods from here: IP Address Calculations with C# (Subnetmasks, Networks, …) and use it like:
To get the the user host address you could use
HttpRequest.UserHostAddressmethod; but remember host address can be spoofed.