Solved

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

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

Expert Comment

by:David Johnson, CD, MVP
Comment Utility
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
Comment Utility
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 78

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
Comment Utility
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
Comment Utility
Thank you for the help
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem with SqlConnection 5 108
Asp.net mvc 5 5 13
Format column on datatable 7 14
Unable  to create new object 9 16
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now