I am developing MVC
4 Razor Application.
I Placed
a “ Action Link “ Download Button which downloads file from HTTPS
Sharepoint Server.
Error : Am getting
403 Forbidden Error in Web Request
Code Snippet :
WebRequest
request = WebRequest.Create(new Uri(url, UriKind.Absolute));
request.Credentials = new NetworkCredential("XYZ", "XYZ");
WebResponse response = request.GetResponse();
Stream fs =
response.GetResponseStream() as Stream;
byte[] buffer = new byte[16 * 1024];
using (MemoryStream ms = new MemoryStream()) {
fs.CopyTo(ms);
buffer=
ms.ToArray();
}
return
File(buffer, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", fileName);
I got
403 Forbidden Exception in Highlighted Area.
No comments:
Post a Comment