title: C# How to spoof IP address for WebRequest
body: <p>I have asp.net website hosted and I am making WebRequest to post data and get response. The website is having IP filtering. I want to spoof sender IP address for testing purpose. Is it possible to do it programmatically or I have to use any tool.</p>
  
  <pre><code>public string GetResponse(string request)
  {  
      lock (Obj)  
      {  
          request = request + _dataControlInfo.SendEndingWith;  
          Logger.Info(request);  
          var req = (HttpWebRequest)WebRequest.Create(_serviceUrl);  
          req.Headers.Add("SOAPAction", "\"\"");  
          req.ContentType = "text/xml;charset=\"utf-8\"";  
          req.Accept = "text/xml";  
          req.Method = "POST";  
          var stm = req.GetRequestStream();  
          var bytes = UtfEncoding.StringToUtf8ByteArray(request);  
          stm.Write(bytes, 0, bytes.Length);  
          stm.Close();  
          var resp = req.GetResponse();  
          var stmr = new StreamReader(resp.GetResponseStream());  
          var strResponseXml = stmr.ReadToEnd();  
          Logger.Info(strResponseXml);  
          return strResponseXml;  
      }  
  }  
  </code></pre>
  
  <p>Please specify any possibilities.</p>