Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a UWP app, and since I am unable to use traditional external databases, I must make a web service.

I am new to asp.net, but I think I am grasping the concept, not too huge of a leap since I am use to using RESTful APIs, just never made one. I just need a few pointers to get me rolling on this.

Things I need to do:

I need to be able to secure the API, it will have user information in it and I do not want someone to dump API results.

I need to authenticate users, 200+ users.

I need permission roles that determine access to specific services. IE, users can log in and view a list of checked in staff, and other resources. I need staff to be able to set their presence (checked-in/checked-out), while I need to let locations/services update their resources available, and events.

I need an administrative level access, so I can fix any issues that arise in the data that I am requested to fix.

I want this all to connect to UWP, but have a website as well.

I can worry about features and getting them to work later in my apps, right now, I just need to collect and store data securely, and allow for logging in as I tie everything together piece by piece.

Thank you,

Odin Wynd

What I have tried:

I am trying to keep this as pure asp.net as possible, and has to be UWP compatible.

I have looked at a few different avenues, but, I am unsure of security of data, and, I am unsure how to administer it overall with what examples I have seen.

I have an access database I am storing info in the meantime with, but, it is useless for UWP as it does not allow any external databases, only internal SQLight is usable in UWP. Not what I need for this project. I need to make a web service.
Posted
Updated 25-Jun-16 7:47am

1 solution

Keep it just ASP.NET, but consume the Web API in the UWP. I have been doing that in a number of applications that I use and I have been writing a lot of articles for this too.

In my own view, all of yours points can be concluded in the following list:

1. You want a web application that controls how users interact and how data is shared.
2. You want to authenticate the users before they can access the data. You also want only authenticated users to get the data, others should not be able to access the resources.
3. You want to use the same data (from the website) to be able to get rendered in the UWP applications.

That was what you were having, so, create a small (or average; 200 users!) web application and define your own schema of database. I won't be of any help, because you haven't shared any such information here. But, as far as that authentication is concerned, all you need to do is just apply Authorize attribute to the controller and ASP.NET will automatically require users to be logged in,
C#
[Authorize]
public class MyController : Controller
{
   // Wont be accessed unless authorized.
   public List<string> Get() {
   }

   // ... Rest of the functions
}
</string>

Then you will be able to consume the API calls in your application to get the data. You can get the data in any format, make sure it can be serialized and deserialized while being transferred on the wire.

All of this has been summarized in this article of mine, ASP.NET 5 Web API RESTful CRUDs and Windows 10 native application[^]. It talks about creating web applications, creating the API portion, allowing the models to be used in the API consumption. After that, the article talks about creating the UWP application (Windows 10 uses UWP application platform) and then article guides you on consuming the API in your application to provide the users with the data from Web API.

If you are novice to ASP.NET, read this article of mine for that: Understanding ASP.NET MVC using real world example, for beginners and intermediate[^]

AuthorizeAttribute Class (System.Web.Mvc)[^]
 
Share this answer
 

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