Reputation: 2882
I have a business logic which has lot of DB fetch operations and a bit complex business logic. Data fetched is rarely changed within the session of user.
Currently we are using Asp.net Forms Application and these business logic is in InSessionScope(). Currently we are working on migrating to Restful API(WebAPI).
Upvotes: 2
Views: 3339
Reputation: 16854
You can use tokens implemented by you or JwtToken.
If you choose implement custom token on login method you must return a token to you app, next in any api call pass this token like a header or query string and decrypt in server to validate propose.
Upvotes: 0
Reputation: 3778
Based on my personal experience NEVER use Session in a Rest Application as AspNET WebAPI are .. even if you can .. but instead use Tokens for Authorization and User Profilation (with AspNet Identity) and for performance (don't hit DB too many times) i suggest to you some ways as i have done:
1 - USE CACHE!
! (there are some great frameworks and lib for cache ..you can use different Layers of cache .. Query .. Response of webapi ..for example I'm use to cache the entire API response (Json) and auto invaildate it on POST / PUT / DELETE request) ..in .NET you can use this https://github.com/filipw/Strathweb.CacheOutput
You can also use Redis
for caching (if you don't want to cache locally in the Server but to have a distribuited cache)
2 - Try to think in NoSQL
way .. in our application we use a mix of DB .. SQL Server but also MongoDB
(expecially for big amount of data ) for example we use SQL server to manage AspNEt Identity but we use MongoDB to store our Product (we have about 6 milions of products) and it take about 1 sec for query (also with aggregation!!) ..
3 - Try to use LocalStorage
on the FrontEnd
if you can to store some information. .and then sync them when you need ..
Hope it can help you.. enjoy WebAPI ..enjoy REST!! (and leave webforms as soon as you can ...in my idea!!)
Upvotes: 6