When it comes to single sign-on, it is often inseparable from the portal. Usually there are many applications in the enterprise, web or CS. Portal is often made into web. After you log on to the portal, how to start the local CS program from the portal becomes a problem to be solved.
I don't know how everyone solves this problem. My approach is to implement a protocol (just like thunder, donkey, and ant financial) on the portal.
Protocol name: // Application name/job? Action = Action & param1 = parameter 1 & param2 = parameter 2...
This example may be (our protocol name is short for the company, and I will use foo here ):
<A href = "foo: // ERP/order? Action = query & owner = hydonlee "> my orders </a>
This design allows the browser to send requests to our applications like handling HTTP links.
So how can we let the browser send this link to our protocol processor? In this case, you need to register with the system (in Windows). The Registry is as follows:
Windows Registry Editor Version 5.00 [hkey_classes_root \ Foo] @ = "url: Foo application protocol" "URL protocol" = "" [hkey_classes_root \ Foo \ defaulticon] @ = "D: \ workspace \ fooportal \ bin \ Client \ foo.protocolhandler.exe, 1 "[hkey_classes_root \ Foo \ shell] [hkey_classes_root \ Foo \ shell \ open] [hkey_classes_root \ Foo \ shell \ open \ command] @ =" \ "D: \ workspace \ fooportal \ bin \ Client \ foo.protocolhandler.exe \ "\" % 1 \""
How is it? Is it easy? After adding this to the Registry, you can start-> Run and enter FOO: // test/and press enter to test your protocol processor! Windows provides the URL as a parameter to the command line.
The C # code for registering a protocol processor is as follows:
Private void fooprotocolregister () {// copyright (c) hydonlee. For more information, see registrykey Cr = registry. classesroot; registrykey fookey = CR. createsubkey ("foo"); // Add the foo key fookey. setvalue ("", "url: Foo Application Protocol"); fookey. setvalue ("URL protocol", ""); // Add defaulticon registrykey iconkey = fookey. createsubkey ("defaulticon"); iconkey. setvalue ("", String. format ("{0}, 1", application. executablepath. tolowerinvariant (); // Add shell key registrykey shellkey = fookey. createsubkey ("shell"); registrykey openkey = shellkey. createsubkey ("open"); registrykey commandkey = openkey. createsubkey ("command"); commandkey. setvalue ("", String. format ("\" {0} \ "\" % 1 \ "", application. executablepath. tolowerinvariant (); fookey. close ();}
In this way, the link from the browser has been passed to our local application, and the rest is relatively simple. The Protocol processor analyzes this address, calls the corresponding job plug-in, and passes in parameters.
Simply put, the portal generates a link through the Protocol address model-> a browser initiates a request-> A protocol processor assigns-> each application plug-in starts a job.
// Copyright (c) hydonlee