title: WebRequest.GetResponse() is throwing error 401: Unauthorized
body: <p>I have an ASP.NET application where I'm trying to output the previously-visited local aspx page to html (its a report and I want to store a static html copy of it as an archive).  I store the uri of the local page with:</p>
  
  <pre><code>Session["SummaryURI"] = Request.Url.AbsoluteUri;
  </code></pre>
  
  <p>and then in the next page I retrieve it with:</p>
  
  <pre><code>string url = Session["SummaryURI"].ToString();
  
  url = url.Replace("static=false", "static=true");
  //MessageLabel.Text = url;
  
  //CREATE THE NEW FILE
  WebRequest req = WebRequest.Create(url);
  WebResponse res = req.GetResponse();
  </code></pre>
  
  <p>The part <code>req.GetResponse()</code> is where I'm getting my error (<code>401 Unauthorized</code>).</p>
  
  <p>Do I need to configure something in IIS to allow this?</p>
  
  <p>Do I need to edit file permissions or something?</p>
  
  <p>Thanks for your help</p>
  
  <p>By the way this works fine on my local IIS but not on my test server.</p>