How to communicate between php and my application on windows server - c#

So basically i want to make a website that upload a file (an executable one .exe)from a user, when it finish upload i have to open this file on the same server (windows server) since my application run on windows
The file will be encrypted by my C# application and i want to be returned to the user by link to they can download it.
My question are:
How to communicate? between them
My application have to be a command line ?
Have you to use API?
Any useful link or some similar source to learn more are very welcome
Thank you a lot community SO.
BV1,

Ideally you should create a web service which could be consumed using your PHP application. This service could be a WCF Service exposing some methods. Look at below code:
ConsumeWCF service from PHP

Related

Desktop WPF Application with remote Web UI like utorrent

I developed a windows desktop application using vb.net. I want to use the application with windows headless server. It will be easier if it has a web interface like utorrent. My initial approach was to write the current state to a text file (JSON/XML) and then read the file from the web interface. but it leads to too much read/write operation. is their any better approach? how about using REST API calls?
You could run a WCF web service from your WPF application, see https://learn.microsoft.com/en-us/dotnet/framework/wcf/how-to-host-a-wcf-service-in-a-managed-application
That would expose an API that you could run a client against (eg. using Javascript on a web page).

Socket.IO & Express alternative for C#?

I'm looking to see if it's possible to create an application using C# that creates a local web server and allows me to pass information from the server, to the client website.
I've been using Node.js with Express to create a local web server and then using Socket.io to pass information through to the client, to display in realtime with Javascript. Only issue is I'm more comfortable with C# and I'd like to distribute this application, with Node Modules and Electron the app is clocking in at around 150MB, it's also many files and folders as opposed to just a .exe
Details of Application:
Reads data from log files
Decodes Json inside files
Sends specific data to website
Client receives data and displays
I've managed to get halfway there by using HttpListener, but from what I understand I cant send data to it? So I figured I could edit the html before I sent it and have yet to setup the FindDivByID method
TLDR; Is there a way to create a Local Web Server (Application) that is able to send data to the Client Website.
EDIT: Thanks for the suggestion, though I'm hoping to keep it all down to one distributable application, that reads the data from the local PC, creates the web server and sends to the clients
Well, if you wanna go full C#, I'd recommend SignalR, very solid
https://www.asp.net/signalr
Alternatively, you could keep your Socket.IO server in Node.JS and use this Socket.IO C# client library to interface with it (although I never really did tried)
https://github.com/Quobject/SocketIoClientDotNet

How to develop Smart Client Application

Hi.
I have several questions. I developed an application using Visual Studio 2010. The application is developed using Windows Form and the program was wrote using C#.
This application needs to be run on a server. There are several clients connected to the server that will access and use that application through the browser. I know this can be done using Smart Client technique. But I don't really understand how to do it. My questions are:
Is there any syntax/class/methods/function that I need to include in my application? How to use it?
What settings/configuration do I need to set up so that the client computer can access the application in the server through their browser?
I know this can be done using ClickOnce but I don't know how. Can anybody tell me or show me the steps that I need to do to implement this?
Is there any syntax/class/methods/function that I need to include in my application? How to use it?
There are a few - but this is a large area. I would point you at couple:
WCF
ASP.NET Web API.
I would advise to use the later as it appears to be where the modern development is heading (at least to me).
Put simply, you will write your own web server, host it either in your WinForms application or migrate your WinForms to be a web application and host it on IIS, for example. Your web server will expose some API, which will likely to be based on HTTP protocol. A client application will hit web URLs. This will be a request-response paradigm.
Because this is a large area, I cannot name you exact classes, but have a look at ASP.NET site for samples.
What settings/configuration do I need to set up so that the client computer can access the application in the server through their browser?
It depends on the technology. Usually it's pretty simple - get it from tutorials and samples. In most cases this will be *.config file XML code and some minor bootstrapping in .cs files.
I know this can be done using ClickOnce but I don't know how. Can anybody tell me or show me the steps that I need to do to implement this?
ClickOnce is a deployment tool. You probably don't need that at this point.

Best way to upload files from iOS app to Windows Server?

My iOS application allows a user to store files such as PDF's, Images, etc. We need to synchronize the app files to the cloud as we also offer the user a web portal to view the same data. I use WCF (Mtom encoding/streaming) in my Windows Forms app but this is not working in Xamarion.iOS (MonoTouch). There seems to be a problem with Mtom message encoding so I'm looking at an alternate and/or better way of getting files uploaded reliably such as streaming, showing progress, and using async await in C# 5 if possible.
What method do you recommend and if you have any sample code or links this would be great. Also, what is required in IIS 7.5 as I run Windows Server 2008 R2. Lastly, any firewall issues as I run a Watchguard appliance so if I need to open anything to allow this to work please advise. I assume though this would occur over HTTP or HTTPS.
I've done some research on web client, webDAV, etc, but not sure what is really the best approach for this scenario.
Thank you.
HttpClient (async) or WebClient will handle uploads just fine. You can create an ASP.NET upload handler or MVC action to read a HTTP posted file.
Some helpful links:
C# HttpClient 4.5 multipart/form-data upload
Getting the upload progress during file upload using Webclient.Uploadfile
http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx
Edit:
See Larry OBrien's answer explaining the iOS 7 native MonoTouch.Foundation.NSUrlSession which allows background transfers.
iOS 7 introduces a new class, MonoTouch.Foundation.NSUrlSession, which is the preferred way to transfer larger files to and from the Web. NSUrlSession transfers can work when the application is in the background.
The programming model is explained in this article.
Here is a sample application that demonstrates the technique.

How to create and save a text file with JavaScript

Do you know any cross-browser method to create and save a file with JavaScript on the client-side?
Considerations:
I can't save it on the server because the file is going to be read from a fiscal printer.
The server can't access the client. This is obvious because we are talking about a web application in the web, so the server can't access a client folder.
New ActiveXObject("Scripting.FileSystemObject"); is ONLY for Internet Explorer and even then not for all versions.
We are talking about printing on a fiscal printer, so I can't ask the cashier in the supermarket to download the text file and save it in a folder where the fiscal printer can read it.
If not JavaScript, what else can I use in my ASP, .Net 4.0, C# web application?
Basically, you said it, "we are talking about a web application." Do you know any web applications that save a file to your hard drive (besides cookies) without showing you a download prompt first?
Having said that, browsers have started to offer a persistence API that goes beyond cookies. (See, for example, this article.) But such a solution wouldn't meet your requirement of being cross-browser.
Your only options are to use persistance APIs from HTML5 or to create a browser plugin (activex control on IE, NPAPI plugin on others) that can do the file access for you. You could use FireBreath to do this, and it would be relatively simple if you know C++.
That said, it is a really dangerous idea; it is difficult to prevent people from using your plugin in other pages, so your plugin has to somehow be smart enough to keep itself from being abused by malicious sites that want to read (or even write) arbitrary data to your hard drive.
There is, after all, a reason why browsers don't natively support this. I'd look at HTML5.
you can do that by Client side Web services just make a function in web service to create a text file in your hard drive then convert the web service in to the client side service when u do that .Net framework make a client side java script then u will be able to call the server side function using Java script in client side after that your file will not be posted in the server it will remain save in your hard drive ok
we came out with a simple windows service nodejs app to be installed in the local machine.
When the web application need to create a file it just sends an API call to this app using localhost and that will write the file for it.
Cheers.

Categories