Solved

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

Posted on 2014-10-21
4
164 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 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