验证通过后打开响应uri

时间:2014-01-14 00:30:40

标签: c# asp.net-mvc authentication ntlm

我正在通过MVC应用程序打开经过NTLM身份验证的站点。

public ActionResult Login(Credentials data)
{
    Uri queryUrl = new Uri("http://someurl.com");

    string domain = "DMZ";

    HttpWebRequest req = WebRequest.Create(queryUrl) as HttpWebRequest;
    NetworkCredential cred = new NetworkCredential(data.UName, data.Pass, domain);
    var cache = new CredentialCache { { queryUrl, "Ntlm", cred } };
    req.Credentials = cache;
    HttpWebResponse response = req.GetResponse() as HttpWebResponse;


    return Redirect(response.ResponseUri.OriginalString);
    //return View();
}

如果我在返回时设置了一个断点,我确实将response.statuscode作为“OK”,验证工作正常。但我不知道如何打开身份验证的URL。通过重定向,我正在使用它再次请求凭据。

0 个答案:

没有答案