Solved

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

Posted on 2014-10-21
4
161 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
  • 2
  • 2
4 Comments
 
LVL 79

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 79

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 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