简体   繁体   English

我可以以编程方式登录到Reporting Services并重定向到该页面吗?

[英]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.

相关问题 借助用于SQL Server Reporting Services的ReportViewer控件,我可以在C#中以编程方式更改子报表吗? - With the ReportViewer Control for SQL Server Reporting Services, can I change the subreport programatically in C#? 使用Reporting Services将组保留在一个页面上 - Keep Group on One Page using Reporting Services 重定向到登录页面 - Redirect To the log in page 使用C#以编程方式登录到网页 - log in to a web page programatically using C# 我可以使用Reporting Services从标准的多页Excel模板生成Excel报告吗? - Can I generate Excel reports from a standard, multi-sheet Excel template using Reporting Services? 如何在不使用控件的情况下仅从报表服务获取数据? - How can I get only data from reporting services without using their controls? ASP.NET页上的Reporting Services呈现错误 - Reporting Services Rendering error on ASP.NET Page 每个部分之后的Reporting Services 2005带有免责声明的报告页面 - Reporting Services 2005 Report with Disclaimers page after each section 我可以从SQL Reporting Services(.rdlc)生成基于图像的PDF报告,而无需将图像保存到任何地方吗? - Can I generate an Image-based PDF report from SQL Reporting Services (.rdlc) with out saving the image anywhere? 如何以编程方式注销当前用户并以另一个身份登录? - How do I programatically log off the current user and log on as another?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM