Solved

finding out if the request is made within the internal network or outside

Posted on 2014-10-21
4
165 Views
Last Modified: 2014-10-26
Hi,

I need to show an additional label, input and button in an ascx page depending on the user requests the page from inside the company or outside the company, what would be the way to achieve this in asp.net?

thank you...
0
Comment
Question by:nicedone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 81

Expert Comment

by:David Johnson, CD, MVP
ID: 40396236
protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Text = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
}
it is up to you to parse the returned ip address
0
 

Author Comment

by:nicedone
ID: 40397307
Hi, i guess i could not tell it right. if the request comes from outside i will hide the label , but if it is within the company then show it. what you give me would reveal the ip but i need to know where the ip belongs? i s it withing the company or outside the company ? if outside hide it if not show it type of a thing
0
 
LVL 81

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 40398341
as I mentioned you need to add your own logic i.e. if the ip address starts with 10. / 192.168. / 172. then it is a local address otherwise it is a remote address.  You can tailor this to meet your requirements.
0
 

Author Closing Comment

by:nicedone
ID: 40405262
Thank you for the help
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question