Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am new in this section. I have to create the web services for android application.

So I have just choose the MVC 5 and Web API 2 for the same. and creates a project.

My code is done no issues in that. But when I published that and shares the base url with android developers they got 403 error, they also need basic authentication.

I don`t know how to do it? I googled and found lots of links but did not get any solution. can any one suggest me how to do it. Can any one suggest me the example solution.

Thanks.
Posted
Comments
NavjotSingh_013 9-Apr-15 8:18am    
I have also created web services for android using Web API.
The best approach for authentication is token based as Web API is state less.

for login you can use any encryption algo and after user authentication create a random token (GUID/ "date"+Math.Random()), save it (you need to keep track which user is sending request, for that create a flat table to record details like first login attempt, logout etc) and return that token in response header. After that for every request from android told them to send that token in 'request header' for authentication. You will verify that token and if valid then proceed further.

Try to debug your web API using Fiddler or some other tool and find the reason for error, there might be issue in routeconfig.cs.

Can you just post the URL you are hitting and code of routeconfig.cs

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900