I try to GET query from MVC app to OWIN SelfHost. Both have WindowsAuth. MVC is running from Visual Studio in one virtual machine, OWIN SelfHost works as service in other virtual machine. Response is always 401. I tried to set Credentials,PreAuthenticate in WebRequest - nothing changed. I can't let anonymous auth in my system. How I should make request? Thanks.
Asked
Active
Viewed 164 times
1 Answers
0
The solution was found:
WebRequest req = WebRequest.Create(Properties.Settings.Default.SelfHostAdress + "/api/data/GetReportsOrgStructTreeView?currentUserName=" + currentUsername + "&parentNodeId=" + parentNodeId + "&filterId=" + filterId);
req.UseDefaultCredentials = true;
req.PreAuthenticate = true;
WebResponse resp = req.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
content = sr.ReadToEnd();
return content;

Роберт Иванов
- 79
- 7