I'm getting a warning: The requested URL returned error: 401 Unauthorized in the log file for a bunch of style sheets and images.
I'm attempting to run prince over an ASP.Net page (.aspx) from within SharePoint. The code is running in elevated privileges (farm account) so I don't understand the warning.
It's still producing an output but not the result I was hoping for.
code snippet
SPSecurity.RunWithElevatedPrivileges(delegate () {
WebRequest request = WebRequest.Create(currentPage);
request.Credentials = CredentialCache.DefaultNetworkCredentials;
WebResponse response = request.GetResponse();
using (stream = response.GetResponseStream())
{
Response.ContentType = "application/pdf";
prn.SetHTML(true);
prn.SetBaseURL(SPContext.Current.Site.Url);
prn.AddStyleSheet(cssFileName);
prn.Convert(stream, Response.OutputStream);
}
response.Close();
});
I'm attempting to run prince over an ASP.Net page (.aspx) from within SharePoint. The code is running in elevated privileges (farm account) so I don't understand the warning.
It's still producing an output but not the result I was hoping for.
code snippet
SPSecurity.RunWithElevatedPrivileges(delegate () {
WebRequest request = WebRequest.Create(currentPage);
request.Credentials = CredentialCache.DefaultNetworkCredentials;
WebResponse response = request.GetResponse();
using (stream = response.GetResponseStream())
{
Response.ContentType = "application/pdf";
prn.SetHTML(true);
prn.SetBaseURL(SPContext.Current.Site.Url);
prn.AddStyleSheet(cssFileName);
prn.Convert(stream, Response.OutputStream);
}
response.Close();
});