I am wanting to create real RESTful APIs with ASP.Net. According to REST architecture. The application must be stateless. Meaning I can't use normal sessions. I found a document here describing how to use Redis as a session state provider. Since it would be external (as in not part of the server), would it be suitable for creating stateless APIs? How would I go about it. Would I just create a key to declare the user as authenticated and then maybe a key to reference the current user, or am I thinking wrong?
Using Redis as a session state provider
2.9k Views Asked by James Parsons At
1
There are 1 best solutions below
Related Questions in ASP.NET
- Create an IIS web request activity light
- Writing/Overwriting to specific XML file from ASP.NET code behind
- What is the point of definnig Asp.net Intrinsic Objects In different places and what is the different betwen them?
- Deleting Orphans with Fluent NHibernate
- IOrderedEnumerable to vb.net IOrderedEnumerable Conversion
- Entity Framework Code First with Fluent API Concurrency `DbUpdateConcurrencyException` Not Raising
- Getting deeply embedded XML element values
- What is best way to check if any of the property of object is null or empty?
- NuGet - Given a type name or a DLL, how can I find the NuGet package?
- ASP-MVC Code-first migrations checkbox not active
- How do i add onclient click to my jquery button
- Jquery: Change contents of <select> tag dynamically
- Retrieving data from Oracle database
- ASP.NET: Fill Textbox field upon dropdownlist selection by user
- Why web API return 404 when deploy to IIS
Related Questions in SESSION
- Access property of an object of type [Model] in JQuery
- __PHP_Incomplete_Class Object even though class is included before session started
- Safari Extension not geting session Info
- Laravel: Locale Session: Controller gets Parameter to change it but it cant. U have to hardcode it
- Does OPEN SYMMETRIC KEY (SQL Server) remain in scope on a server farm?
- Superagent share session / cookie info with actual browser
- Session Destroyed on page refresh
- MVC Referencing strongly typed session objects on my view
- What is the best way to persist a global array in php?
- Error in indicies while unsetting Sessions
- Server side PHP session is not working in android
- Laravel - session data survives log-out/log-in, even for different users
- The page isn't redirecting properly when I logout
- Session array unset and delete row
- Validating a login using PHP
Related Questions in REDIS
- start redis with supervisor
- How to do Mass insertion in Redis using JAVA?
- RedisResponseException: Unknown reply on multi-request
- Redis / Get all keys & values from redis with prefix
- Remove a member from multiple sets in Redis
- Using memcached or Redis on aws-elasticache
- Get Socket Object by Id with node, redis-adapter and socket.io
- how can i save a complex json as string in redis and retrieve it as unescaped legit json object
- How to specify versions on PIP when installing a python package with it's dependencies
- Eloquent model for Redis
- Is exists check required before calling StringSet method of StrackExchange.Redis
- Predis: Pros and Cons of the two cluster strategies
- hmset redis with result from mysqlDB
- does redis cluster support transactions ?
- How change redis to be persistent
Related Questions in STATELESS
- Using Redis as a session state provider
- How does different phases of JSF lifecycle behave in a stateless view containing a form
- TStateMachine<TState, TTrigger>.TStateConfiguration.OnEntry is never fired
- on using rxjs to update props of a react functional stateless component
- If render functions should be pure, how the view can get changed based on state?
- Does stateless only transfers client's state to somewhere else?
- how to share the token between classes
- Does ST(State Transfer) in REST mean that state must be held by client?
- How to distinguish application state and resource state
- Is there a stateless version of the JPA EntityManager?
- Use Spring MVC for Stateless web application development
- How to do stateless (session-less) & cookie-less authentication?
- Wicket ajaxeventbehavior causes page refresh in subpanels
- Stateless Micro services and database
- Ruby on Rails as a RESTful architecture
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You could use Redis as a cache to hold various pieces of state about the user. The idea is that when the user logs in, you probably need to load a bunch of information about them from your database (name, address, etc...) at that point, you know the user will likely need to reuse some of that information, so you don't want to keep reloading it from the database each time. Instead you can cache it in Redis for a few minutes, so on the user's next request you can just pull the data very quickly from Redis instead of having to go back to your database.
For authentication, you could create a temporary token in the redis cache that you also throw back to the user as a cookie so that you can check for it's existence on subsequent requests instead of needing to run a bunch of time-consuming bcrypt hashes or some such for each subsequent authentication.
This all remains stateless because even if the cache is not available for whatever reason, the user's requests still contain all the state necessary to answer his or her requests. All that Redis is doing is allowing you to speed up your responses if it's available.