?
Solved

IP Address Restriction for a Web-Service in ASP.NET !

Posted on 2006-05-07
3
Medium Priority
?
341 Views
Last Modified: 2008-03-10

Hi,

I want to know how we can do IP Address Restriction for a Web-Service in ASP.NET. Can you provide the sample Server and Client applications for this ! Can we do by using programatically ?

Thanks,
Kishore
0
Comment
Question by:kishore_peddi
3 Comments
 
LVL 6

Assisted Solution

by:junglerover77
junglerover77 earned 600 total points
ID: 16627919
Context.ApplicationInstance.Request.UserHostAddress.ToString()
0
 
LVL 15

Accepted Solution

by:
GavinMannion earned 800 total points
ID: 16629467
Maybe a bit more detail?

If you are trying to secure it by declining non compliant IP addresses I don't think it is the best way since these can be faked.

Using junglerover77's answer you would basically just have the following

[WebMethod]
public string TestMethod()
{
    if( Context.ApplicationInstance.Request.UserHostAddress.ToString() != "192.0.0.1" )
    {
        return null;
    }
    else
    {
         //Process request
    }
}
0
 
LVL 6

Assisted Solution

by:nehaya
nehaya earned 600 total points
ID: 16629490
It's in IIS settings, exactly as any webapplication.
I'm not sure about doing it programmatically.

see this greate example
http://www.dotnetjunkies.com/Tutorial/5D8B6D51-97B7-4825-B919-49A721A3FDF6.dcik

// using
Context.ApplicationInstance.Request.UserHostAddress.ToString()
is not as safe as using IIS, but if you want more security, you can use it as second gate.
See the link above and note how securing IIS and webserivces will make better security.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

807 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