Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>UPDATE:</strong> </p> <p>Just read your updated question. Since you're running into login issues, try doing this before you execute the request:</p> <pre><code>request.Credentials = CredentialCache.DefaultCredentials </code></pre> <p>If this doesn't work, then perhaps the problem is that authentication is not being enforced on static files, but is being enforced on dynamic files. In this case, you'll need to log in first (using your client code) and retain the login cookie (using <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.cookiecontainer.aspx" rel="nofollow noreferrer"><code>HttpWebRequest.CookieContainer</code></a> on the login request as well as on the second request) or turn off authentication on the page you're trying to access.</p> <p><strong>ORIGINAL:</strong></p> <p>Since it works with one HTTP URL and doesn't work with another, the place to start diagnosing this is figuring out what's different between the two requests, at the HTTP level, which accounts for the difference in behavior in your code.</p> <p>To figure out the difference, I'd use Fiddler (<a href="http://fiddlertool.com" rel="nofollow noreferrer">http://fiddlertool.com</a>) to compare the two requests. Compare the HTTP headers. Are they the same? In particular, are they the same HTTP content type? If not, that's likely the source of your problem. </p> <p>If headers are the same, make sure both the static and dynamic image are exactly the same content and file type on the server. (e.g. use File...Save As to save the image in a browser to your disk). Then use Fiddler's Hex View to compare the image content. Can you see any obvious differences?</p> <p>Finally, I'm sure you've already checked this, but just making sure: <code>/Publication/render_citation_chart.aspx</code> refers to an actual image file, not an HTML wrapper around an IMG element, right? This would account for the behavior you're seeing, where a browser renders the image OK but your code doesn't.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload