簡體   English   中英

我可以以編程方式登錄到Reporting Services並重定向到該頁面嗎?

[英]Can I programatically log into Reporting Services and Redirect to the page?

我目前有一個SQL Server Reporting Services網站,該網站不屬於域(我知道這並不理想,但在這種情況下我沒有選擇)。 我想做的是以編程方式從ASP.NET MVC頁面登錄該站點,然后重定向到Reporting Services頁面以查看報告,而不必鍵入用戶名和密碼。 我知道這不是最佳做法,但是在這種情況下,這是我需要做的。

我在想像這樣的東西,但它不起作用:

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");
}

我想我的代碼與所需的代碼相差很遠,但是我認為您可以通過查看代碼來理解我要做什么。 我猜我可能需要POST才能登錄Reporting Services / IIS,但是我不確定。

我擁有的Reporting Services版本是SQL Server 2008附帶的版本(不是R2)。 如果有人能指出我正確的方向,將不勝感激。

看起來我將接受以上評論中Jeroen的建議。 (http://stackoverflow.com/questions/6144513/how-can-i-use-a-reportviewer-control-in-an-asp-net-mvc-3-razor-view)

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM