How to have a SharePoint action invoke a feature in a WinForms application launched by Click-Once? - winforms

We have a SharePoint site that our users have open all the time (type of dashboard for the business). We have a WinForms application that listens on a specific port for when the user clicks a web part on the SharePoint site, we take the JSON in the WinForms, parse the request and launch a feature in the WinForms. Essentially allowing a web site to launch a feature in a running WinForms app on the same client machine.
This worked great when we were running in XP. When we moved to Windows 7 (with elevated UAC), this feature stopped working. Since we launch the WinForms app via ClickOnce, and ClickOnce apps can't be Run As Administrator, our current code won't work.
We can't make the ClickOnce app Run As Administrator for all the reasons you see here on StackOverflow.
So my question is: how can we invoke a feature in a ClickOnce deployed WinForms app when a user clicks on something in SharePoint site? It is super easy to get the WinForms app to call a Sharepoint web service but I need to go the otherway.

You can invoke a ClickOnce application by calling the deployment manifest URL. If you want to be able to call the app and have it do something specific, call the deployment manifest URL and pass query parameters to it, then have the application handle the query parameters.
This article shows you how to handle query parameters with ClickOnce applications.

Related

Can you Run winform app in the cloud as a process?

Currently, I have full access to a local Windows IIS System in which we execute a windows forms application as a processes in which the winform app runs and takes a screen shot of itself and the web call returns the URL of the saved image. The full process looks like -
User navigates to webpage
User inputs variables on web page and submits it to IIS end point.
IIS takes variables, runs Process.Start on winform app passing in variables.
IIS returns the URL from the screen capture of the winform app.
Is this something that is doable on Azure or Amazon? I'd like to put this in the cloud but I'm not sure if security restrictions would prevent an app like this from being executed as we had to give specific permissions to get this to work.
If you do this now on a server with IIS, you would be able to do it in the cloud (azure or amazon although I have no amazon experience so I'm guessing). The real question is what would you have to deploy. In this case, you cannot use an app service as your platform for this, you would have to run it in a virtual machine with IIS and configure everything as you do now. Or, if you are adventurous and need load balancing, etc. you could try a virtual machine scale set.
One caveat, since I do not know what the windows application does, what it depends on, you may need to put in some networking configuration if the windows app communicates back to an on-prem database or file store.

What are the alternatives to Windows security subsystem in .NET winforms applications

I'm about to start development work on .NET 4.0 winforms application running on top of a Microsoft SQL Server 2012 database.
The number of users supposed to use the application might be any where between 2 to 10 and the application should be able to run either on a single stand alone computer or in an intranet in a windows environment.
in case the application is run on a single computer, each user would log into the application (not into windows) and perform what ever tasks they are authorized to do and then log out of the application.
If the application is configured to run on a small intranet, each user would log into the application from there respective office computers and do what ever they are authorized to do.
So, the application can run on a single none networked machine, where a single windows login account is being shared by staff at the facility but i have a requirement to allow access to certain application functionality depending on who is logged into the application, NOT who is logged into windows as the account might just be shared.
I have previously deployed ASP.NET applications in networked environments and used the SQL Membership, Roles and Profiles provider for authentication and authorization While for winforms apps, i have relied on active directory authentication.
Now with this particular project, i am wondering what the best solution might be. Probably some one here has implemented a solution for such a scenario and can give advice.
I have looked at this http://www.codeproject.com/Articles/27670/Implementing-Application-Security-with-Client-Appl solution but i still want to hear from the SO masses.
ALSO, any recommendation for a better post Title is welcome.
Once I worked in a WinForm application which was supposed to run on intranet, each user would log into the application....and this application was using centralized web service to authentication and other CRUD operation....The service was mediator between WinForm app and DB.
The approach given in code project article which u mentioned in question...is also fine.
Anyway I also got curious here....As you said u are about to start development in .Net 4.0 Winform.....I would like to understand why you made this choice over WPF? What reasons u got to favor WinForm in your scenario ?

"Calls to the web service will fail..." Once Again

Last year someone reported encountering this problem ("The Silverlight project you are about to debug uses web services. Calls to the web service will fail unless the silverlight project is hosted in and launched from the same web project that contains the web services.") and accepted the answer to "set the web project which hosts the Silverlight application to be your startup project."
I'm seeing the same message, but think the solution might have to be different. I am building in VS 2010 a Silverlight application to access the Google Weather API, with VB as the code-behind. The API will return a XML file with data for the specified city (ex., "http://www.google.com/ig/api?weather=london,england"). The Solution Explorer only shows my VB/Silverlight project ("GetWeather"), and the Project Properties dialog box shows the Startup Object as "GetWeather.App" -- the only choice. I'm trying to use a WebClient object to make the call and an XDocument object to parse the return. But I repeatedly get the above error message, with no other result. What am I doing wrong?
Thank you in advance!
I would add a simple Web project and configure it to host the Silverlight app. You'll need to host the app somewhere anyways, so why not create a stub ASP.NET application in your solution? The easiest way is to create a new Silverlight app solution selecting an ASP.NET web project as the host, and then copying your existing code to that solution. Then you should set the web project as the startup one. This should make debugging a lot easier.
Besides, do remember to configure the client access policy to enable cross-domain calls. Check out this article

Start WPF application from link in browser?

We have a requirement to start a WPF application with specific parameters from a link in a browser.
We are wondering if this is possible?
As an alternative could we embed the web application in a WPF browser control, and read the values out of the html web page?
Several possibilities :
if you control the browser (i.e. if you are in an intranet scenario, and have the opportunity to deploy applications), you can :
create an activex or plugin that runs the application
register a new uri scheme to interpret the url of kind "yourapplication://yourarguments"
(complex): deploy a listening app ran under the user session, and from the webapplication, ask this listening app to run the target application
reduce the security of the browser (not recommended)
if you don't control the browser:
create a clickonce application... this involves a setup, but which does not require admin privilege
Moving to Silverlight also might be an option, depending on your needs. SilverLigth V5 (still in beta) notably adds the ability for an admin to control the rights of the application via a GPO
Note: My feelings is the later option (Silverlight) is far more preferable because it's a lot more cleaner and less security hole factor. However, it can only be done if your requirements fits into the SL features
It is not possible to call client app from a browser, previously it was possible from activex controls but for that you need to have a signed library, in wpf you can make browser based application but you cant embed your web app in it.
So partially you are correct if you used wpf app you will be able to launch application on client side but with browser it seems difficult until unless you make activex control
but still i am not 100% sure that with activex control you will be able to launch the app or not

Access Sharepoint webservice from Silverlight with specfic user credentials

I am accessing Sharepoint web services from a Silverlight application, I have put the clientaccesspolicy.xml file in the root of my Sharepoint site, so I can access fine.
What I would like to do though is hard code the user credentials so the web service always connects with the same user.
Is this possible and if so how?
Thanks in advance.
After emailing Tim Heuer, I was informed that is not possible in SL3, but will be in SL4!
I've recently ran into similar case where I need to pass a specific credential to the generated web service client proxy in Silverlight 4 OOB. For whatever reason I am still getting prompted for authentication so, I'm not sure if it's there in SL4.
What I know possible in SL4 is you can force an HttpRequest to use a ClientHttp stack instead of the WebBrowser one. I've used this with SharePoint 2010 OData feed (_vti_bin/listdata.svc) before successfully, but to access SharePoint Web Services (for example: _vti_bin/lists.asmx), it's a different story.
I finally decided to create my own workaround (specific to SL OOB w/ Elevated Privilege) for this that should work on SL3 OOB and SL4 OOB with elevated privilege. Basically creating my own SharePoint Web Service proxy using the ClientHttp stack and composing and passing my own SOAP message manually using WebRequest.
I blogged about how to do this here.

Resources