Communication between Windows Form Application and Web Page in C# - c#

I am developing a windows based application using C#.
This should be used by the customer after some verification.
Every time they enter the details, the information should be validated in the server. And based on the response the windows-application should proceed further.
Could you please suggest me some examples or technologies ideal for this scenario?
I read through the documentations about WebClient and HttpWebRequest. But still I am not clear. Sorry I am an Embedded Systems Programmer. I haven't worked on Server related technologies.
Thanks for your help.

I would look at Windows Communication Foundation it is a service and messaging framework designed for exactly what you want to do.

a webservice would be a good solution.
look here for more information on creating a webservice:
http://www.codeproject.com/KB/webservices/myservice.aspx
then you can import your webservice like a reference to a class and use it in your clientside c# programm.
http://www.xefteri.com/articles/show.cfm?id=15
this article is for VB, but it shouldn't be a problem, the important thing is the referencing, which is Visual Studio specific and not VB specific.

I would look at a WCF service using a NetTcpBinding. Here is a good link:
http://msdn.microsoft.com/en-us/magazine/cc163394.aspx
I am a little unsure what your reference to a web page in the post title refers to.

Related

Launch Citrix 7.6 Storefront Published App Programmatically

I've been looking through tons of forum posts and documentation, but I can not find out how to authenticate/launch an app published through a Citrix 7.6 Storefront interface programmatically (preferably in C#). I'm extremely new to working with Citrix so any help would be appreciated.
At my company, we currently have a launcher like I described that works with Citrix 6.5 Web Interface, but we get generic errors when we attempt to use the same technique with 7.6 Storefront.
Can anyone provide me with a sample application doing what I want or point me towards an appropriate SDK/Documentation resource? I would be EXCEPTIONALLY grateful for any assistance!
Thanks!
Very very old post but since I was struggling as well, here's some pointers that works well with StoreFront 3.5.
First of all, the following code works with the StoreFront web api and basic HTTP authentication. You must first do this on the StoreFront server to enabled the authentication with the following code:
Open Citrix StoreFront
Click on "Manage Authentication Method"
Check the box "Basic HTTP"
Here's a class that you can drop in that will work given that you install the following nuget packages:
RestSharp
JSON.NET
WebApi C# Sample
(Sorry I wasn't able to past the code directly here because of formatting)
The sample can be copy/pasted into a console application. I have written and cleaned up the code such that anyone can understand and use it.
if you are using the Receiver 4.0 you can use the Receivers -qlaunch parameter.
See the Citrix dokumentation https://support.citrix.com/article/CTX200337
SelfService.exe –qlaunch “appname” is the command and you can use the process start command in c# to launch the application by name.
I hope this will also help as a simple solution.
Regards Bernd

Building a remote command for Elpis in C# through HTTP API

I am helping to build Elpis, which is an open source pandora music player, built with C# and WPF.
Now what i want is to add an HTTP API so that the user may control the program through a browser, like play/pause, like/dislike the current song.
The point afterwards is to control the program through a mobile device accessing the HTTP API.
How exactly should i build the HTTP API so that it can control it?
Github for the project: https://github.com/adammhaile/Elpis
Without knowing why exactly you want the user to control a GUI application via the browser, it's hard to give you good advise.
Assuming you are running your GUI on Windows, take a look at OWIN and the project Katana. They allow you to easily host HTTP interfaces in your own application.
It may be overkill for your project but I would suggest using ASP.NET Web API so that you can build backend web services.
The easiest way to do what you want, assuming you really want to "control the GUI remotely" is to just install TeamViewer on your PC and on your mobile device. Then you could remote in and completely control your GUI.
But I what I think you're after is something more like Google Music. Where you can stream your music through the Internet and onto your mobile devices. If this is the case, I recommend you look at the ASP.NET Web API.
It's not hard to build a web server in C#. You can embed it into your application, and expose parts of your application to HTTP endpoints as an API. You can use the HttpListener class which is part of .NET, and do everything from the ground up yourself. Or you could use something like Nancy, which is a lightweight framework that provides a lot of useful scaffolding like URL routing.
Ended up using Kayak(https://github.com/kayak/kayak) for my self-hosted API.
The example of integration can be seen here:
https://github.com/adammhaile/Elpis/blob/master/Elpis/WebInterface.cs

SaaS development using .Net

I do not know how to explain this in technical terms. So let me begin with an example:
Story
I have an online e-commerce site www.ABCStore.com . I built this using MVC 4 (Razor) in Dot Net.
My friend has a travel agency for which his online site is www.DEFAgency.com . He got it built in Java.
Both our websites were up and running. One fine day I got a call from a company FicticiousServiceProvider and they asked me if I would be interested in getting customer feedback as a functionality on my website without having to write any code myself. What they offered was, I would have to include just a single line of code in the footer of my Masterpage(or layout page) and then the customers who log on to the site would see a small icon on the pages and would be able to provide their feedback.
The feedback will not be available directly to me. The FicticiousServiceProvider guys will analyze the data and provide them to me on a regular basis or on a need basis.
There were other services too which they offered.
I was really happy to have a functionality like that, specially without having to write any code. I tried it and it worked fine in my .Net website. My friend(with a java website) also added a single line to his code and it worked for him too.
My questions here are:
What is this process called ?
If I were FicticiousServiceProvider, how would I have developed this using .Net ? I mean, how to develop a functionality so that a consumer can consume the service using a single line provided by the service provider. Data transfer from my site in the form of feedback to the FicticiousServiceProvider is also happening, without me being able to see anything.
How was it possible for FicticiousServiceProvider to provide the functionality to a .Net app and a java app without any change in the line provided by them?
I have given the description from a consumers perspective. Please suggest from a developer's perspective. Many Thanks.
These things, like Google Analytics tracking code, are usually some kind of javascript injecton. It will use javascript to 'inject' a bit of code that sends a request to their servers (what their server side is coded in is irrelevant really). They then handle the request that includes the information they've gathered in javascript on the client side and store it, then use server side software to analyse that data to give out reports, etc..
So to try and answer your question separately.
I'd call the process javascript injection.
You would have to find the best way to send a request to your servers and handle that request. Could be done with ASP.Net MVC quite easily but any server side technology/code that can handle requests and send data to a store.
They use javascript which is separate to any server side code and works across browsers on the client side.

How to communicate between ASP.NET & C# Application

I am in the process of developing a project that will require communication both ways between a ASP.NET website and a C# Application.
For example if I wanted to click a button on an ASP.NET webpage to retrieve the status of something.
How could I implement this communication between them?
Please note I have never used ASP.NET before, hence my question.
You can use same database in both website and application. If you want to transfer something from application to website, like a file, then you will need a web service or WCF service. But your wish seems like a shared database by website and application.
I think You should go through this link.....it has all the basics of asp.net and c# in very easy manner compared to all the other websites....
http://www.w3schools.com/
You could make the C# application write data somewhere and have ASP.NET read it there. Either to a database (which makes the most sense), or to some file, like an XML or JSON.
Storing communication on a database seems like an easy way to do it.
You could use a webservice, but that would need to be hosted by the website. The application could still poll this to write and read when needed though.
I think I found what I was looking for:
A Beginner's Tutorial for Understanding Windows Communication Foundation (WCF)
http://www.codeproject.com/Articles/406096/A-beginners-tutorial-for-understanding-Windows

Best Practices for Exchanging data between Desktop and Web Application

I have to pass information from a desktop application to Web application and vice versa.
What are the best practices that are regularly used?
Currrently I'm using Asp.Net and a Winforms.
To pass data to Web Site im creating a (POST) WebRequest and posting an xml to the site.
To pass data to Application im using .Net Remoting from Asp.net
(I'm using Winforms is an adminstration and monitoring application.)
Edit: Lets treat it as a generic web app and winforms.
Also currently both Web app and Winforms are on the same machine.(but can change).
Web Services or Windows Communication Foundation (WCF) would be your best bets for remote interoperability.
On your website, expose some service end points and consume them from your desktop app. Then send messages as you require.
I'd look hard at the design of the system and consider whether it's necessary to use a Winforms application at all for monitoring and administration. No, really: creating rich Web sites is quite straightforward (if necessary, with technologies like AJAX) and the architecture of the resulting application will be much, much simpler.
And, of course, deployment is then really simple.
I am not sure if there is a best practice for what you are trying to accomplish. There might be some security concerns you have to think about when allowing posts to your web application however. It would be very easy for a potential attacker to manipulate the post data and send it to your web application. You should consider using web services or Windows Communication Foundation.
Register a custom handler like how Real player registers rstp:// or for that matter web browsers register http://

Categories