I've created a 2 custom action:
1. TestReportServerUrl
2. PublishReports (deffered)
both establish a ReportService2005 instance and then sets the URL and
Credentials (username, password and domain) captured using custom dialog.
[CustomAction]
public static ActionResult TestReportServerUrl(Session session)
{
ActionResult result;
session.Log("TestReportServerUrl: Begin");
if (null == session)
{
throw new ArgumentNullException("session");
}
try
{
string reportserverurl = session["REPORTSERVER_URL"];
string reportserveruser = session["REPORTSERVERUSER"];
string reportserverpassword =
session["REPORTSERVERPASSWORD"];
string reportserverdomain = null;
if (reportserveruser.IndexOf("\\") >= 0)
{
reportserverdomain = reportserveruser.Substring(0,
reportserveruser.IndexOf("\\"));
reportserveruser =
reportserveruser.Substring(reportserveruser.IndexOf("\\") + 1);
}
else if (reportserveruser.IndexOf("@") >= 0)
{
reportserverdomain =
reportserveruser.Substring(reportserveruser.IndexOf("@") + 1);
reportserveruser = reportserveruser.Substring(0,
reportserveruser.IndexOf("\\"));
}
try
{
using (SSRS.ReportingService2005 service = new
SSRS.ReportingService2005())
{
if (!String.IsNullOrEmpty(reportserveruser) &&
!String.IsNullOrEmpty(reportserverpassword))
{
service.Credentials = new
System.Net.NetworkCredential(reportserveruser, reportserverpassword,
reportserverdomain);
}
else
{
service.Credentials =
System.Net.CredentialCache.DefaultCredentials;
}
service.Url = reportserverurl +
"/reportservice2005.asmx";
service.ListChildren("/", false);
session["REPORTSERVERISVALID"] = "1";
}
}
catch(Exception exi)
{
string credentials =
String.Format("User:\t{0}\r\nPassword:\t{1}\r\nDomain:\t{2}",
reportserveruser, reportserverpassword, reportserverdomain);
ExceptionDialog.Show("Failed to connect to Report
Service.\r\nMake sure the Server is Running and that the Report Server Url
is correct.\r\nCredentials\r\n" + credentials, exi);
session.Log("TestReportServerUrl: exception: {0}",
exi.ToString());
session["REPORTSERVERISVALID"] = "0";
}
result = ActionResult.Success;
}
catch (Exception ex)
{
result = ActionResult.Failure;
session.Log("TestReportServerUrl: exception: {0}",
ex.Message);
}
return result;
}
If I however attempt to get a List of Catalog Items I get An Exception:
System.Net.WebException: The request failed with HTTP status 401:
Unauthorized.
I am really stuck any help will be appreciated?
Thanks
Jaco Roux
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users