asp.net - Set IP address of HttpWebRequest -


i have site fixed ip address, , make c# calls backend data server methods via httpwebrequest. backend system set permit incoming requests site's ip fixed address.

is there way set ip address of httpwebrequest site's ip (i suspect cloud host or .net somehow permitting other ips being used)?

i'm not trying spoof ip; want ensure asp.net code uses site's own dedicated ip, or @ least check see ips may using when makes requests.

use httpwebrequest.servicepoint.bindipendpointdelegate property:

request.servicepoint.bindipendpointdelegate = delegate      {          return new ipendpoint(ipaddress.parse("10.0.0.3"), 0);      }; 

example:

using system; using system.net; using system.io;  class program {     public static void main ()     {         var request = (httpwebrequest)httpwebrequest.create ("http://smsc.vianett.no/ip/");         request.servicepoint.bindipendpointdelegate = delegate { return new ipendpoint(ipaddress.parse("your_ip_here"), 0); };         var response = (httpwebresponse)request.getresponse ();         console.writeline (new streamreader (response.getresponsestream ()).readtoend ());     } } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -