Click here to Skip to main content
15,887,376 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I want launch ssms.exe from angular href click.
If I click on the server it has to launch ssms with details

I have tried to launch with winform, It worked for me.

Below is the code for Winform.

What I have tried:

Winform link label details:
lnkSqlServer.Links.Add(0, lnkSqlServer.Text.Length, "-S " + Server + Instance + " -d " + Database + "-E");


C#
private void lnkSqlServer_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("ssms.exe", e.Link.LinkData.ToString());
        }



Angular 6 HTML cocde:

HTML
<li class="list-group-item">Server :
            <a href='"-S " + {{model.Server}} + {{model.Instance }} + " -d " + {{model.Database }} +"-E"' target="_ssms.exe">
              {{model.Server}} 
            </a>
          </li>
Posted
Updated 25-Jul-18 11:06am
v2
Comments
MadMyche 25-Jul-18 17:29pm    
Are you launching this on the client machine?
Member 13801408 26-Jul-18 13:28pm    
No, in local machine.

This is internal app

1 solution

HTML and client-side javascript cannot launch an executable on the client machine, for obvious security reasons.

You can, however, tell the server to launch an executable on the server. Your server-side code just has to expose a method that the client-side code can call. This server-side method would launch the required executable with the required parameters.

The client-side code would call this method, just like any other AJAX call back to the server. You could even pass parameters to the server-side method.

There's tons of examples on the web for AJAX calls. Just Google for it.


But, think about this. Would you REALLY want hundreds of clients all telling the server to launch an executable? That's a bit of a resource drain on the web server.

Also, would you want just anyone to be able to call this method? You might want to think about security around this.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900