-1

I am using the ReportViewer in my WPF application and I am trying to get a custom protocol to work with the application. So I get the ability to open sub-programs inside my application when a url is clicked inside the ReportViewer.

When I click on the custom-protocol-url (inside the ReportViewer) nothing happens. When I open the same report via the Web-Browser, my URL works flawlessly.

It seems like the ReportViewer doesn't allow custom protocols? Has anyone experienced that aswell? Is there any documentation on that?

http, https and mailto are working in the ReportViewer.

I am just adding an Action in the Report pointing to my url customurl://123

Url definition:

[HKEY_CLASSES_ROOT\customurl]
@="URL: customurl Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\customurl\shell]

[HKEY_CLASSES_ROOT\customurl\shell\open]

[HKEY_CLASSES_ROOT\customurl\shell\open\command]
@="\"C:\\Extra Programme\\TestAlert.exe\" \"%1\""

Testalert (just the test-program by microsoft):

static string ProcessInput(string s)
{
    // TODO Verify and validate the input 
    // string as appropriate for your application.
    return s;
}

static void Main(string[] args)
{
    Console.WriteLine("Alert.exe invoked with the following parameters.\r\n");
    Console.WriteLine("Raw command-line: \n\t" + Environment.CommandLine);

    Console.WriteLine("\n\nArguments:\n");
    foreach (string s in args)
    {
        Console.WriteLine("\t" + ProcessInput(s));
    }
    Console.WriteLine("\nPress any key to continue...");
    Console.ReadKey();
}
bergerb
  • 71
  • 7
  • You might want to add more detail. I understand your question but others may not, hence why you are getting votes to close this question. Edit your question to show an example of the full URL and how it's setup in the report etc. Also, do normal http: URLs work OK from within the ReportViewer control? I never use it so I am only guessing and offering troubleshooting advice at the moment – Alan Schofield Nov 26 '20 at 10:33

1 Answers1

0

I have looked into the code of ReportViewer and found an if statement, that checks if the url starts with either http:// or https:// or mailto:.

It gets this information with Uri.UriSchemeHttp, Uri.UriSchemeHttps and Uri.UriSchemeMailto

So you could overwrite eg. Uri.UriSchemeHttp with "customurl" (if your url is customurl://123) before rendering the report.

var field = typeof(Uri).GetField("UriSchemeHttp");
field.SetValue(null, "customurl");

The more elegant solution would be, to use a webbrowser control and just show the SSRS Web-Page

bergerb
  • 71
  • 7