title: Soap service credential available from InputStream
body: <p>For a project I am doing, I am using a SOAP service to access some data from another system. I added the SOAP service as a web reference to my ASP.NET (C#) project.</p>
  
  <p>Now, the service is kinda complicated, because a user has to be authenticated first with a cookie (don't ask). So what we did was:</p>
  
  <ul>
  <li>The user accesses our website.</li>
  <li>Website redirects the user to a logon page on the server where the service is located.</li>
  <li>User logs on, and a FormsAuthentication.SetAuthCookie is performed</li>
  <li>User is redirected back to our site. Which then forwards the user to a page which should contain data from the webservice.</li>
  </ul>
  
  <p>That page instantiates the webservice as an object like this:</p>
  
  <pre><code>MyService.MyServiceservice = new MyService.MyService();
  </code></pre>
  
  <p>Then I put the credentials in (now I do it hardcoded):</p>
  
  <pre><code>service.PreAuthenticate = true;
  service.Credentials = new NetworkCredential("Wim", "mypass");
  </code></pre>
  
  <p>When I call a method on that service, I want the Global.asax on the server containing the server, to be able to "catch" the username and password from the request. But somehow I cannot fetch it.</p>
  
  <p>Don't ask why it has to be done like this, lets call it .. unfortunate :P</p>
  
  <p>Does anyone know how to fetch the username and password from that request on the server side, preferable in the Global.asax Application_BeginRequest.</p>