Windows application and website server communication - c#

In my project I have created an application in windows using C#.
In the application I want to connect to my web server (or domain) and send a request to it,
and then in my web server I want to create a page or a web application to answer the request !
For example I want to send a request like 'Name?' from my windows application,
then I should be able to get the request text in my web server (www.mydomain.com) and answer properly. (e.g. 'jack').
How should I do this !?
should I use chat server? (if so, isn't there any easiest way?)
Any other Idea?
Thanks in advanced.

I would recommend taking a look at the .net WebRequest class.
http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx

You should take a look at web service, I think that is what you want. Here is code project link http://www.codeproject.com/Articles/16325/NET-Web-Services-Concepts. And you should also take a look at WCF, that would also help you.

Related

WCF Service Get Data From Client Application And Send to Web Application (Asp.NET)

This is my situation, I need to get a data from a smart card through a client application, after that I need to pass that data to my web application written in VB.NET(Asp.NET). I've read that its possible to do it with WCF Service but couldn't really figure it how. I've google about it but all the tutorial only tell process of web application and web service. But in my case, it is client application to web services to web application.
Any help/suggestion is appreciated. Thanks in advance.
For your client application (for example, a winform), take a look at this:
Smart card reader development with .Net technologies
You can after that create a WCF or REST api that will receive your request after reading whatever you need from your smart card (from your client application):
https://learn.microsoft.com/en-us/aspnet/web-api/overview/older-versions/build-restful-apis-with-aspnet-web-api
Finally, you have to send your data from your client application to your webapi:
How do I make calls to a REST api using c#?
Note: If you want to create a wcf instead of the web api, take a look at this:
https://www.codeproject.com/Articles/42643/Creating-and-Consuming-Your-First-WCF-Service
Let me know if you need more info. Also, provide more information about what you already have and what you don't (do you have the client application?)

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

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

Add and Remove roster in eJabberd via asp.net web application

Hihi, would like to automate the adding and removing of eJabberd roster from my web application on asp.net, c#. Is there any advice on this?
I have been looking and trying on jsjac and jabber-net with no luck. Appreciate any guide on this.
Thanks in advance!
:)
you can do this by creating a new Ejabberd http Request handler module.
Create New http Request Handler Module. http://www.process-one.net/en/wiki/ejabberd_HTTP_request_handlers/ which accepts the data and processes it as you need,
asign that module a url address in ejabberd config, then call that http-handler with a curl like serive (in php I used CURL, I don't know what is the replacement for this in ASP.NET).
Eventually, I have switched my eJabberd db to MySQL, and established a connection directly into the MySQL db from my web application for manipulating all the eJabberd's actions.
:)

File Upload to HTTP server from iPhone application. Server side C# API method

Could someone please tell me/link me to how I could create a method similar to those posted below:
http://www.vimeo.com/api/docs/upload
http://www.flickr.com/services/api/upload.api.html
(I am providing the links as I'm not sure how to articulate this question without them!)
I'm using C# ASP.NET. IIS 6.
I have an existing web server with other public API methods. I do not want the iPhone user to have to open a web browser, and post to an aspx page. I want the iPhone developer to be able to call my method, and have one of the parameters be a handle to the file which gets POSTed.
Thanks in advance for any help.
You'll need to create a WCF Service Application. You can use this as a webservice that can be exposed to your clients. You can create a RESTful service using WCF where clients can POST video's to.
When searching for 'REST, API, WCF' you'll probably find all the resources you are looking for.

Categories