What is the use of stateConnectionString in sessionState in Web.config? - visual-studio-2005

I'm using VS 2005 for web forms.
Looking at the web.config I see a stateConnectionString attribute.
Is this really needed?
When is this needed?
How is this used?

Do you mean sqlConnectionString attribute? If you do then it is used if you set the state server mode to SqlServer for usage in a web farm scenario. It is the box running the Sql Server for the session state store.

Related

Developer specific application settings in ASP.Net Core?

What is the best way of storing/loading developer specific application configuration settings in asp.net core. The support it provides for Dev/Staging/Production is great but...
It looks that you need user secrets.
Sensitive values are stored in 'separate' place on machine, and app during startup add this values to other settings.

AppFabric 1.1 Session State Caching and Distributed Caching Configuration

I have 0 experience of AppFabric but was given a task while some people were on vacation.
First question is, don't you need to configure Session State Caching and Distributed Cache on the server hosting AppFabric before you can code against it and use it?
If so where do I find information on how to do it cause I can't find any?
If not, where do I find information on what I need to include for each cache (this is for Sharepoint 2013 apps)?
Anyone who has expiernce that can help me?
Session State Caching doesn't require any server-side setup, it's purely client side, using the AppFabricCacheSessionStoreProvider class. For Sharepoint and AppFabric, there's a overview and configuration guide on MSDN, and a page on how to manage the Sharepoint Distributed Cache service on technet with an associated download on configuration and installation

ASP.NET Universal Providers & Azure - Users Created Through ASP.NET Configuration Not Working

Describing this in detail is going to be tough but here goes:
Configuration
ASP.NET MVC 3.0 Website Project
Visual Studio 2010 SP1
Windows Azure Deployment including, Compute, Storage and SQL
SQL Azure has two sets of DB's; Development & Production
Problem
Using the ASP.NET Universal Providers I've setup a Development_ApplicationServices DB in my SQL Azure account. I've then gone in to the ASP.NET Configuration Website and created users for Development and assigned them to roles. As there are multiple developers working on this project this works well so we consistently have the same default accounts available to test role related use cases. Development has been running smoothly without any issues with the Providers.
I posted the Application to an Azure Compute Instance today for the 1st time and tried to login. Suddenly, the accounts we've been using, despite pointing at the same database are not working. If I register a new account it works fine while I'm in the Azure environment however, if I run in the development environment and then the account I created on the Azure instance using the default Register function of MVC in the Account Controller isn't accessible though I can see it in the DB if I query directly.
Question
Does the Universal Provider embed something about the Site Context (for lack of a better term) into the hash for UserID or Password?
Is there a best practice for the way I've configured by Dev/Prod environment, as it relates to SQL Azure and Membership Services, that I can use as reference?
Happy to answer questions to make this more clear but I'm pretty stumped at this point and don't know what would be relevant to include since this seems odd, to me at least.
Thanks in advance,
K
I was also getting this exact same behavior. I posted a question on the official Azure forums ( http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/e8944c4d-5e22-4844-82fc-2e6863f0901a ) and was directed to the answer in another post here on stackoverflow I didn't find during my initial searching.
You'll find the answer here:
ASP.NET Membership - login works locally, fails on Azure
To summarize, the hashing type used on Azure is different from that which is now the default for .NET 4.0. You have to explicitely override the default machineKey element and the hashAlgorithmType attribute of the membership element in the Web.config to specify the hashing method to use.
It worked for me!

Using the Azure AppFabric Cache in ASP.NET MVC

I have configured the Azure AppFabric Cache as session provider in my ASP.NET MVC application.
How do i store session data in Azure Cache?
Is it the same was as with inProc session?
Like by using ViewBag, TempData and stuff?
Thanks.
If you haven't already, I'd encourage you to have a look at this section in the Windows Azure Training Kit. It does a very good job of demonstrating how to use Windows Azure Caching.
http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_buildingappswithcacheservice#_Toc310505077
If you configured AppFabric as session provider you can now use Session State just in the same way when you had InProc session. Other features that use Session State (for example TempData) also work.

Best Practices: Using Session in Windows Azure with multiple instances

Can anyone tell me that if I use Session(inside an ASP.NET MVC 3 application) in Windows Azure environment with multiple instances(means multiple virtual machines), then it work without any configuration or I need to use ASP.NET Universal Providers or I need to handle this manually by using AppFabric?
You can't use in-process session state, but must use a shared session state provider.
The only supported session state model is to use Azure Cache, but you can use a provider that works with either Azure Storage or SQL Azure.
UPDATE:
I wrote some articles on my blog which go into using SQL Azure for session state with Entity Framework Code First. Hopefully, you'll find useful pointers there, even if you're not using Entity Framework.
Something to bear in mind using the standard SQL Server Session State Provider is that it doesn't have the retry logic which is considered good practice when working with SQL Azure.
This discussion on ASP.NET MVC providers may help you:
http://azureproviders.codeplex.com/discussions/276053
, also, look here for how to implement a session provider using Azure AppFabric Caching:
http://weblogs.asp.net/shijuvarghese/archive/2011/05/04/using-windows-azure-appfabric-caching.aspx
"...Without any configuration..."
As Steve Morgan mentioned, The Azure AppFabric Cache provides a supported mechanism for caching. The cache itself is independent from your compute instances. In fact, a single cache could be accessed by multiple applications, if you wanted to use it in such a way.
Regarding configuration, you'll have to modify web.config, as the AppFabric Cache has a custom cache provider. The web.config snippet itself is auto-generated for you via the portal; it's as easy as copy-n-paste.
You can find out more info on caching, including sizes and pricing, here.

Resources