Send Data Via Http In C# - c#

I am creating Android Application for a school where teachers should be login to the android application and perform some activity on daily basis.
We have a complete existing web based solution for the same and now want to implement same in Android.
The application is developed in Asp.net and C#
To authenticate a user on android login, I have created a login API which takes username and password in the query string and in return the API return Json Data From That User.
example : www.yourdomain.com/authenticateuser.aspx?username=xxxx&pas=YYYYY
But I doubt whether its safe to send the data via query string.
Can anybody suggest a better possible way where it is not mandatory to send the data in Query String.

You can use Soap based web-service. I created a demo to consume Soap Web-service without KSoap Library.
Ref Link: SoapWithoutKSoap
You can use KSoap Library to create complex Soap Data Request.
I hope this can help you.
C# Web-Service: Demo and Demo1
UPDATE
Web Service Link will be something like this : http://123.456.789.012/Abhan/Abhan.asmx?op=JustTest (This is not working as I modified the IP Address)
In Browser, method name and passing parameter(s) information will be like something as attached image.
Thanks.

I'm using C# web services to autenticate users, send report data and get app updates.
You can get some exmaples in the web (C#):
http://msdn.microsoft.com/en-us/library/8wbhsy70%28v=vs.90%29.aspx
and ksoap2 for Android:
http://code.google.com/p/ksoap2-android/
But I also bought a SSL certificate to use https...

Related

Trying to use a xamarin app to create a user login for a website

I have a cross platform app currently designed using xamarin forms but now need to use this to create a user profile for the user, using the information provided, for a website.
Are there any add ons or plugins for something like square space or wordpress which would allow me to upload a user program via a RESTful api or something along those lines?
Basically what are my options to transfer user data from a cross platform app to a web app so that my user can then log onto the web app and see all their information?
All you need is a database that can be accessed by both your web app and your mobile app. There are numerous services that would allow you to do this.
But if your web site is going to be a WordPress site (I have never looked into squarespace) then it already uses a MySql back end for data storage. I would imagine squarespace uses a database of some sort as well. You could then create RESTFul urls on that same server to send and request data and use whatever database system that your website is using. If you don't want to implement your own service code for sending and receiveing data that can be used by both your web app and your mobile app, then you could use some service like Azure, AWS, Apigee, etc. just for the database.

Prevent unwanted access to my web service

I have coded a C# MVC5 Internet application and I have a Web API 2 web service that returns JSON data. I am retrieving this JSON data in an android application.
How can I add a feature to the web service such that only my android application can retrieve the JSON data? I am wanting to do this so that other web users cannot hammer the url and the web service will not send my data to unwanted applications and/or users.
Is this possible? If so, how should I do this?
Thanks in advance.
You have various ways to achieve this in fact.
For example, you can store a key in your android application and use send this key together with the request to your WebAPI. Your webAPI will than check if they key is valid and if it is, it will return the JSon.
However, there's no way to ensure that nobody else can request and get your data. For example by reverse engineering your android application and extracting the key, or by monitoring the network traffic and find the key in there.
You need to understand that there isn't anthing that guarantuees you 100% security.
See it as the following:
You have an open door right now, you can close it little by little, but closing and locking down is not possible. There will always be gap. A house also can't by made burglar proof, but you can make it very hard for a buglar to enter.
Go to this link Web Api. I have used the individual authentication for my web api. When you will register the user the response you will get is access token and use that access token as Authentication header in your ajax call if you are using Jquery ajax to call your Web Api. Refer this The OAuth 2.0 Authorization Framework. Hope this help you.
Are you looking for something like this?
http://httpd.apache.org/docs/2.2/howto/access.html
If you have other web server, there should be appropriate means to support such.

Returning JSON from WCF after POST in Android

I just started coding for my android application and I am unsure of how I should start coding.
If I want to do lets say a login in my android application. How should i start?
Is it possible if I do it in this way:
Send POST to my WebService > Web Service Validates credentials > Return user information
Please help!
Yes your process is correct.
If you have simple needs like what you describe using the default serializer should be enough, just specify:
WebMessageFormat.Json
Later if you need a full fledged JSON library use Json.NET
A small tutorial to get you started (it uses a similar use-case): http://www.codeproject.com/Articles/167159/How-to-create-a-JSON-WCF-RESTful-Service-in-60-sec
Do not forget to use authentication over HTTPS only...

What are my options for sending data from Windows app back to developer without using a webserver

I am writing a simple WPF quiz application for a family member and he would like users of this application to have the option to send him their scores once they have completed the quiz. I was hoping to do this without the need to create some kind of webservice for the app to talk back to.
My initial idea was to email the results back, but that runs into problems. What if there is no SMTP client on the user's machine? I don't want to embed a password for a public smtp server into the application. I could do a Process.Start("mailto:..."), but that requires their machine to have a handler for mailto: and for them to click submit on the generated email.
Another idea I had was that the app could add a line into a Google docs spreadsheet, but that would mean a google docs password would need to be embedded in the app.
So my question is, without me writing a separate application running on a webserver for my WPF app to talk to, is there a good way of my app sending data back to me that doesn't require a password? I'm guessing there must be some kind of public webservice I could use for this?
If you're happy with a third party service that can do this for you, consider Parse, or any other 'backend as a service' provider.
You should then be able to implement something else that reads the saved data from the service when required, without having to expose itself as an API.
Create a google doc forms and when you need the user to submit their score, launch a web browser with the doc url. You can auto-populate the fields by query parameters( ... &entry_0=Barney&entry_1=Google& ... )

Facebook Connect and .NET

I have an ASP.NET application and a Windows Service. My ASP.NET application allows for users to allow the application to connect with Facebook. If a user has connected the application with Facebook, the Windows Service will later (sometimes much later) post a message on the user's News Feed. I have two questions:
What information do I need to collect from Facebook?
How do I collect that information?
I know that I will need to save some information back to a database that both the ASP.NET application and the Windows Service can access. I have this approach working with Twitter. But I am trying to figure out how to do it with Facebook without much luck.
Thank you for your help.
You're basically limited to the list of "ids" in terms of data you can "save back to a database". For example, on a connect site, you cannot store their "name" or "about" for more than 24 hours:
http://wiki.developers.facebook.com/index.php/Storable_Data
To actually get the data you'll want to use one of the following API methods:
http://wiki.developers.facebook.com/index.php/Users.getInfo
http://wiki.developers.facebook.com/index.php/Users.getStandardInfo
More than likely, getInfo as getStandardInfo returns you cannot display publicly. You'll of course need to use Facebook Connect to first authenticate the user, then you can query the API using Javascript or an ASP.NET FB library to get API results. You'll find a load of client libraries here:
http://wiki.developers.facebook.com/index.php/Client_Libraries
http://wiki.developers.facebook.com/index.php/ASP.NET

Categories

Resources