[英]Can I programatically log into Reporting Services and Redirect to the page?
I currently have a SQL Server Reporting Services site which is not part of a domain (i know that is not ideal but I do not have an option in this situation). 我目前有一个SQL Server Reporting Services网站,该网站不属于域(我知道这并不理想,但在这种情况下我没有选择)。 What I would like to do is programmatically log into the site from my ASP.NET MVC page and then redirect to the reporting services page to view the reports without having to type the username and password.
我想做的是以编程方式从ASP.NET MVC页面登录该站点,然后重定向到Reporting Services页面以查看报告,而不必键入用户名和密码。 I know this is not best practice to do this but in this situation it is what i need to do.
我知道这不是最佳做法,但是在这种情况下,这是我需要做的。
I am thinking of something like this but it is not working: 我在想像这样的东西,但它不起作用:
public ActionResult LogIntoReportingServices()
{
HttpWebRequest wr = WebRequest.CreateHttp("http://example.com/Reports");
NetworkCredential nc = new NetworkCredential("report_user", "password");
wr.Credentials = nc;
wr.GetResponse();
return Redirect("http://example.com/Reports");
}
Im guessing my code is pretty far off from what is needed but I think you can understand what I am trying to do from looking at it. 我想我的代码与所需的代码相差很远,但是我认为您可以通过查看代码来理解我要做什么。 I am guessing I may need to POST to log into Reporting Services/IIS but i am not sure.
我猜我可能需要POST才能登录Reporting Services / IIS,但是我不确定。
The version of Reporting Services I have is the one that Comes with SQL Server 2008 (not R2). 我拥有的Reporting Services版本是SQL Server 2008附带的版本(不是R2)。 If someone can point me in the right direction that would be appreciated.
如果有人能指出我正确的方向,将不胜感激。
Looks like I am going to go with Jeroen's suggestion from the above comment. 看起来我将接受以上评论中Jeroen的建议。 (http://stackoverflow.com/questions/6144513/how-can-i-use-a-reportviewer-control-in-an-asp-net-mvc-3-razor-view)
(http://stackoverflow.com/questions/6144513/how-can-i-use-a-reportviewer-control-in-an-asp-net-mvc-3-razor-view)
Thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.