简体   繁体   中英

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). 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. 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.

The version of Reporting Services I have is the one that Comes with SQL Server 2008 (not 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. (http://stackoverflow.com/questions/6144513/how-can-i-use-a-reportviewer-control-in-an-asp-net-mvc-3-razor-view)

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM