title: vb.NET WebRequest to read aspx page to string, access denied?
body: <p>I'm trying to make an executable in VS2008 that will read a webpage source code using a vb.NET function into a string variable. The problem is that the page is not *.html but rather *.aspx.</p>
  
  <p>I need a way to execute the aspx and get the displayed html into a string.</p>
  
  <p>The page I want to read is any page of this type: <a href="http://www.realtor.ca/PropertyDetails.aspx?PropertyID=9620716" rel="nofollow">http://www.realtor.ca/PropertyDetails.aspx?PropertyID=9620716</a></p>
  
  <p>I have tried the following code, which works properly for html pages, but generates the wrong source code with "access denied" for the page title when I pass in the above aspx page.</p>
  
  <pre><code>    Dim myReq As WebRequest = WebRequest.Create(url)
  
      Dim myWebResponse As WebResponse = myReq.GetResponse()
  
      Dim dataStream As Stream = myWebResponse.GetResponseStream()
  
      Dim reader As New StreamReader(dataStream, System.Text.Encoding.UTF8)
  
      Dim responseFromServer As String = reader.ReadToEnd()
  </code></pre>
  
  <p>Any suggestions or ideas?</p>