desktop application data send to web application - asp.net

Work on .net application my application has one desktop(windows form) and web application(MVC5), in desktop application have one button, client on button want to display one image in my web application.
Is there any idea how to do ?

What about using SignalR.
You can make connection between your Desktop App and Web App
then you can call any method you need from Desktop to Web and vice versa.
ASP.NET SignalR is a library for ASP.NET developers that simplifies
the process of adding real-time web functionality to applications.
Real-time web functionality is the ability to have server code push
content to connected clients instantly as it becomes available, rather
than having the server wait for a client to request new data
Read more here: Asp.net SignalR.

Through the webapi it will works.

Related

Using Duende IdentityServer with a mix of clients, including Blazor WASM and ASP.NET Web Forms

We have a legacy Web Forms app that we intend to slowly port over, module by module, to Blazor WASM. As we do not have the capacity to rebuild everything in Blazor straight away, we are going to have to run the Blazor and Web Forms app side by side for the time being. To the end user, this needs to appear seamless - i.e. they don't notice when they're being switched between the two.
The first thing I am trying to sort out is the log in process. We have decided to use IdentityServer to build an external identity provider which both the Blazor and Web Forms app will communicate with. Currently I am just trying to create some proof of concept models to see if I can actually get this to work.
I have managed to build a sample Blazor WASM app and a sample Web Forms app that both communicate with the same IdentityServer app to log in. Both of these apps recoginise upon initial load whether a user is already logged in to IdentityServer or not and they show or hide a claims page accordingly.
If I log out of the Web Forms app and then refresh the page in the Blazor app, the Blazor app requires me to log in again - which is what I want. I'm doing this by setting:
BackChannelLogoutUri = "https://localhost:7260/bff/backchannel"
in the IdentityServer Config.cs file for my Blazor client.
What I can't work out is how to get my Web Forms app to behave in a similar fashion. If I log out of my Blazor app, the Web Forms app remains signed in. I am not sure what the equivalent FrontChannelLogoutUri or BackChannelLogoutUri would be for the Web Forms app.
The Web Forms sample app I am using as my template is the sample provided by Duende themselves, which is here:
https://github.com/DuendeSoftware/Samples/tree/main/various/clients/Owin
(Firstly, these "technology migration" projects are tough , so I wish you the best of luck!)
You need a have two "Front channel server-side clients", so the BackChannelLogoutUri setting is useless. So you need to pay attention to this part of the Identity Server documentation.
Alternatively (as I have done the same in a similar project) you can call a service api in the other UI client and then use a technology like SignalR to notify all open browser tabs of the logging-out user in any other UI to trigger log out.

Allow some controllers to one app and not the others

We are developing a mobile app and this app will call the same APIs as the web one.
We want to create specific controllers for the mobile app and prevent it from calling the ones for the web app and vice versa.
Both apps send an access token which contains the client_id for each app.
Is it possible to do something like this :
[Authorize("mobileOnly")]
And check in the OnAuthorization if the request comes from the mobile or web app.
Or is there a better solution?
Edit: We are using .Net framework not .Net Core

building a web proxy to a desktop application using .net

We have a regular .Net4 desktop application built using WPF that exposes a handful of methods via WCF as Net.tcp and also WSHTTP as a rest interface for some simple remote control and remote querying. This is so we can provide some easy 'dashboards' that keep track of what each of the applications is doing around an organisation. We have used MVVM patterns wherever possible with future expansion in mind.
We now need to build a web application for users to do some remote work. Most of this work will be done by the web interface itself directly accessing the SQL database and other resources and rendering HTML back to the end user.
We also want the users of this web application to be able view these dashboards for certain specified desktops, at which point we need to then have the Web application query the desktop applications for the answers.
In due course it's likely that we will expand this further to expose REST or SignalR based or similar to support a Xamarin based set of apps.
My current theory is that we will build this web application using ASP.Net and host on IIS and whenever the user needs to access a resource that requires connecting to the desktops we spin up a WCF connection to the REST services running on it, send the query, process the result and return it onwards to the user.
Is this the best way to go about it, or is there some sort of native web service "proxy" that we can utilise to transparently forward the request from the website user onto the desktop?
Any and all advice would be greatly appreciated!

Convert asp.net application to windows forms app

I have written and deployed an ASP.NET application that is pretty complex. It uses XSL transformations to create web forms for a large variety of data objects. The data comes from the database as XML via a web service.
Now, I need to create a Windows desktop application that will provide a small subset of the web applications functionality to a user who may not have access to the web (working in remote areas). I will provide the data syncing using the MS Sync Framework. And I will have the desktop use a local data store.
I would like to use the same xslt files in the desktop app that I use in the web app for the form creation so that, if changes are made, the desktop app can update itself when it connects and syncs its data.
But, I am wondering how to replicate the asp.net codebehind logic of my web app in the windows forms. If I use a browser control to render the XSLTransformation result, then how could I handle click events, etc, in the form? Also, can I launch other windows as "dialog boxes" from my windows forms (I do this in my web app using RadControls functionality)?
Thanks for any advice you can give.

Can I host an ASP.NET application in a CAB WinForms application?

I have a .NET 2.0 WinForms application that was developed using the Composite Application Block and Smart Client Software Factory.
I'm considering the development of a module that would contain a browser control that would access the ASP.NET website using credentials established when the user logged into the WinForms client.
My goal is to use this strategy to transition all of the modules that are currently in the client to ASP.NET and retire the 'smart' client. Security for the WinForms client is currently implemented using the ASP.NET Membership functionality.
Is this possible? Sensible?
Yes, you can. Make a SmartPart that hosts the WebBrowser control, add some buttons for forward and backward navigation, and a url textbox; then point the WebBrowser control at your web application's URL.
It is sensible. We used CAB/SCSF to create an application we called "The Integrated Desktop". This application serves as the platform for all internal apps for the company; everything is integrated into this one desktop application. We added a foundational module, basically a beefy version of what I described in the above paragraph, to facilitate web browsing since a few pre-existing apps were web-based and our users wanted access to those at the same place they were doing all their other work. One cool thing was the use of the WebBrowser's ObjectForScripting property that allowed for somewhat seamless integration between the desktop app and the web app being hosted inside.
What are your requirements?
You would choose a web app over a smart client mainly
if you have to reach people that
are not on the Windows platform or
you have a need for a
zero-install app
By having your app users having to access the web app via the smart client (browser-control) you would be missing (1) and (2). In my opinion it would defeat its purpose.

Resources