├── .gitignore ├── .nuget ├── NuGet.Config ├── NuGet.exe └── NuGet.targets ├── CODE-OF-CONDUCT.md ├── CONTRIBUTING.md ├── License.txt ├── Microsoft.Aspnet.SessionState.sln ├── MicrosoftAspNetSessionState.msbuild ├── Readme.md ├── SECURITY.md ├── azure-pipeline └── azure-pipeline.yml ├── build.cmd ├── clean.cmd ├── docs ├── CosmosDBSessionStateProviderAsync.md ├── SessionStateModule.md └── SqlSessionStateProviderAsync.md ├── src ├── CosmosDBSessionStateProviderAsync │ ├── CosmosDBSessionStateProviderAsync.cs │ ├── Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── SR.Designer.cs │ │ └── SR.resx │ ├── SessionStateActionsConverter.cs │ ├── SessionStateItem.cs │ ├── SystemTextJsonSerializer.cs │ └── TimeSpanConverter.cs ├── SessionStateModule │ ├── AppSettings.cs │ ├── InProcSessionStateStoreAsync.cs │ ├── Microsoft.AspNet.SessionState.SessionStateModule.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── SR.Designer.cs │ │ └── SR.resx │ ├── SessionEventSource.cs │ ├── SessionOnEndTarget.cs │ ├── SessionStateItemCollections.cs │ ├── SessionStateModuleAsync.cs │ ├── SessionStateStoreProviderAsyncBase.cs │ ├── StateSerializationUtil.cs │ └── TaskAsyncHelper.cs ├── SqlSessionStateProviderAsync │ ├── ISqlSessionStateRepository.cs │ ├── Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── SR.Designer.cs │ │ └── SR.resx │ ├── SqlCommandExtension.cs │ ├── SqlCommandHelper.cs │ ├── SqlFxCompatSessionStateRepository.cs │ ├── SqlInMemoryTableSessionStateRepository.cs │ ├── SqlParameterCollectionExtension.cs │ ├── SqlSessionStateProviderAsync.cs │ ├── SqlSessionStateRepository.cs │ ├── SqlSessionStateRepositoryUtil.cs │ └── StringExtensions.cs └── packages │ ├── CosmosDBSessionStateProviderAsync.nupkg │ ├── Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.nuproj │ ├── Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.nuspec │ └── content │ │ └── Net462 │ │ ├── web.config.install.xdt │ │ └── web.config.uninstall.xdt │ ├── Packages.csproj │ ├── SessionStateModule.nupkg │ ├── Microsoft.AspNet.SessionState.SessionStateModule.nuproj │ ├── Microsoft.AspNet.SessionState.SessionStateModule.nuspec │ └── content │ │ └── Net462 │ │ ├── web.config.install.xdt │ │ └── web.config.uninstall.xdt │ ├── SqlSessionStateProviderAsync.nupkg │ ├── Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.nuproj │ ├── Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.nuspec │ └── content │ │ └── Net462 │ │ ├── web.config.install.xdt │ │ └── web.config.uninstall.xdt │ └── assets │ └── dotnet-icon.png ├── test ├── Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test │ ├── 35MSSharedLib1024.snk │ ├── CosmosDBSessionStateProviderAsyncTest.cs │ ├── Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── SessionStateItemTest.cs ├── Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test │ ├── InProcSessionStateStoreAsync.cs │ ├── Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test.csproj │ └── Properties │ │ └── AssemblyInfo.cs └── Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test │ ├── Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test.csproj │ ├── Properties │ └── AssemblyInfo.cs │ ├── SqlCommandHelperTest.cs │ └── SqlSessionStateAsyncProviderTest.cs └── tools ├── .verif.whitelist ├── 35MSSharedLib1024.snk ├── CosmosDBSessionStateProviderAsync.settings.targets ├── MicrosoftAspNetSessionState.settings.targets ├── NuGet.targets ├── NuGetProj.targets ├── NuProj.Tasks.dll ├── SessionStateModule.settings.targets ├── SqlSessionStateProviderAsync.settings.targets ├── signing.targets └── version.targets /.gitignore: -------------------------------------------------------------------------------- 1 | [Oo]bj/ 2 | [Bb]in/ 3 | .vs/ 4 | msbuild.* 5 | obj/ 6 | /packages/ 7 | .binaries/ -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/AspNetSessionState/97428df0dbe5aac2e93f394cf08afffb45382c4a/.nuget/NuGet.exe -------------------------------------------------------------------------------- /.nuget/NuGet.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\..\ 5 | 6 | 7 | false 8 | 9 | 10 | false 11 | 12 | 13 | true 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) 31 | 32 | 33 | 34 | 35 | $(SolutionDir).nuget 36 | 37 | 38 | 39 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config 40 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config 41 | 42 | 43 | 44 | $(MSBuildProjectDirectory)\packages.config 45 | $(PackagesProjectConfig) 46 | 47 | 48 | 49 | 50 | $(NuGetToolsPath)\NuGet.exe 51 | @(PackageSource) 52 | 53 | "$(NuGetExePath)" 54 | mono --runtime=v4.0.30319 $(NuGetExePath) 55 | 56 | $(TargetDir.Trim('\\')) 57 | 58 | -RequireConsent 59 | -NonInteractive 60 | 61 | "$(SolutionDir)" 62 | "$(SolutionDir)" 63 | 64 | 65 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) 66 | $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols 67 | 68 | 69 | 70 | RestorePackages; 71 | $(BuildDependsOn); 72 | 73 | 74 | 75 | 76 | $(BuildDependsOn); 77 | BuildPackage; 78 | 79 | 80 | 81 | 82 | 83 | 84 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 99 | 100 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /CODE-OF-CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | This project has adopted the code of conduct defined by the Contributor Covenant 4 | to clarify expected behavior in our community. 5 | 6 | For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). 7 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | One of the easiest ways to contribute is to participate in discussions and discuss issues. You can also contribute by submitting pull requests with code changes. 4 | 5 | 6 | ## General feedback and discussions? 7 | Please start a discussion on the [Issue tracker](https://github.com/aspnet/AspNetSessionState/issues). 8 | 9 | 10 | ## Bugs and feature requests? 11 | For non-security related bugs please log a new issue according to the [Functional bug template](https://github.com/aspnet/AspNetSessionState/wiki/Functional-bug-template). 12 | 13 | 14 | 15 | ## Reporting security issues and bugs 16 | Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://technet.microsoft.com/en-us/security/ff852094.aspx). 17 | 18 | 19 | ## Contributing code and content 20 | 21 | **Obtaining the source code** 22 | 23 | If you are an outside contributer, please fork the repository. See the GitHub documentation for [forking a repo](https://help.github.com/articles/fork-a-repo/) if you have any questions about this. 24 | 25 | **Submitting a pull request** 26 | 27 | You will need to sign a [Contributor License Agreement](https://cla.opensource.microsoft.com//) when submitting your pull request. To complete the Contributor License Agreement (CLA), you will need to follow the instructions provided by the CLA bot when you send the pull request. This needs to only be done once for any Microsoft OSS project. 28 | 29 | If you don't know what a pull request is read this article: https://help.github.com/articles/using-pull-requests. Make sure the respository can build and all tests pass. 30 | 31 | **Commit/Pull Request Format** 32 | 33 | ``` 34 | Summary of the changes (Less than 80 chars) 35 | - Detail 1 36 | - Detail 2 37 | 38 | Addresses #bugnumber (in this specific format) 39 | ``` 40 | 41 | **Tests** 42 | 43 | - Tests need to be provided for every bug/feature that is completed. 44 | - Tests only need to be present for issues that need to be verified by QA (e.g. not tasks) 45 | - If there is a scenario that is far too hard to test there does not need to be a test for it. 46 | - "Too hard" is determined by the team as a whole. 47 | 48 | **Feedback** 49 | 50 | Your pull request will now go through extensive checks by the subject matter experts on our team. Please be patient; we have hundreds of pull requests across all of our repositories. Update your pull request according to feedback until it is approved by one of the ASP.NET team members. After that, one of our team members will add the pull request to **dev**. -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Microsoft Corporation 2 | All rights reserved. 3 | 4 | MIT License 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the ""Software""), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Microsoft.Aspnet.SessionState.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33213.308 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{58E8143E-86D8-4CA3-AAC3-1CF253D91207}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{93AD624B-85A6-4EE9-B40E-42914D40C0CF}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync", "src\SqlSessionStateProviderAsync\Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.csproj", "{493B0482-572A-4465-BD52-4094351C2647}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync", "src\CosmosDBSessionStateProviderAsync\Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.csproj", "{4CFB2896-D5C1-4E96-A3DA-D57C58539209}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SessionState.SessionStateModule", "src\SessionStateModule\Microsoft.AspNet.SessionState.SessionStateModule.csproj", "{7238F90D-3BCE-4F40-A5BA-EA36AD484BD6}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test", "test\Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test\Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test.csproj", "{CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test", "test\Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test\Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test.csproj", "{2AF89ACA-3545-432D-8D99-C5230E8643A8}" 19 | EndProject 20 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{78F4C27F-37B4-4D27-B198-F601359EC691}" 21 | ProjectSection(SolutionItems) = preProject 22 | tools\CosmosDBSessionStateProviderAsync.settings.targets = tools\CosmosDBSessionStateProviderAsync.settings.targets 23 | tools\MicrosoftAspNetSessionState.settings.targets = tools\MicrosoftAspNetSessionState.settings.targets 24 | tools\SessionStateModule.settings.targets = tools\SessionStateModule.settings.targets 25 | tools\SqlSessionStateProviderAsync.settings.targets = tools\SqlSessionStateProviderAsync.settings.targets 26 | EndProjectSection 27 | EndProject 28 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Packages", "src\packages\Packages.csproj", "{7EC5863F-7FF1-41C7-A384-8FFF81531E7A}" 29 | ProjectSection(ProjectDependencies) = postProject 30 | {7238F90D-3BCE-4F40-A5BA-EA36AD484BD6} = {7238F90D-3BCE-4F40-A5BA-EA36AD484BD6} 31 | {493B0482-572A-4465-BD52-4094351C2647} = {493B0482-572A-4465-BD52-4094351C2647} 32 | {4CFB2896-D5C1-4E96-A3DA-D57C58539209} = {4CFB2896-D5C1-4E96-A3DA-D57C58539209} 33 | EndProjectSection 34 | EndProject 35 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{3626D7CE-EDDB-4B2A-83E1-A1B69FDB874A}" 36 | ProjectSection(SolutionItems) = preProject 37 | docs\CosmosDBSessionStateProviderAsync.md = docs\CosmosDBSessionStateProviderAsync.md 38 | Readme.md = Readme.md 39 | docs\SessionStateModule.md = docs\SessionStateModule.md 40 | docs\SqlSessionStateProviderAsync.md = docs\SqlSessionStateProviderAsync.md 41 | EndProjectSection 42 | EndProject 43 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test", "test\Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test\Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test.csproj", "{AD91AAF5-3B57-4C8C-9A39-92FB578AF317}" 44 | EndProject 45 | Global 46 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 47 | Debug|Any CPU = Debug|Any CPU 48 | Release|Any CPU = Release|Any CPU 49 | EndGlobalSection 50 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 51 | {493B0482-572A-4465-BD52-4094351C2647}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 52 | {493B0482-572A-4465-BD52-4094351C2647}.Debug|Any CPU.Build.0 = Debug|Any CPU 53 | {493B0482-572A-4465-BD52-4094351C2647}.Release|Any CPU.ActiveCfg = Release|Any CPU 54 | {493B0482-572A-4465-BD52-4094351C2647}.Release|Any CPU.Build.0 = Release|Any CPU 55 | {4CFB2896-D5C1-4E96-A3DA-D57C58539209}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 56 | {4CFB2896-D5C1-4E96-A3DA-D57C58539209}.Debug|Any CPU.Build.0 = Debug|Any CPU 57 | {4CFB2896-D5C1-4E96-A3DA-D57C58539209}.Release|Any CPU.ActiveCfg = Release|Any CPU 58 | {4CFB2896-D5C1-4E96-A3DA-D57C58539209}.Release|Any CPU.Build.0 = Release|Any CPU 59 | {7238F90D-3BCE-4F40-A5BA-EA36AD484BD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 60 | {7238F90D-3BCE-4F40-A5BA-EA36AD484BD6}.Debug|Any CPU.Build.0 = Debug|Any CPU 61 | {7238F90D-3BCE-4F40-A5BA-EA36AD484BD6}.Release|Any CPU.ActiveCfg = Release|Any CPU 62 | {7238F90D-3BCE-4F40-A5BA-EA36AD484BD6}.Release|Any CPU.Build.0 = Release|Any CPU 63 | {CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 64 | {CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2}.Debug|Any CPU.Build.0 = Debug|Any CPU 65 | {CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2}.Release|Any CPU.ActiveCfg = Release|Any CPU 66 | {CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2}.Release|Any CPU.Build.0 = Release|Any CPU 67 | {2AF89ACA-3545-432D-8D99-C5230E8643A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 68 | {2AF89ACA-3545-432D-8D99-C5230E8643A8}.Debug|Any CPU.Build.0 = Debug|Any CPU 69 | {2AF89ACA-3545-432D-8D99-C5230E8643A8}.Release|Any CPU.ActiveCfg = Release|Any CPU 70 | {2AF89ACA-3545-432D-8D99-C5230E8643A8}.Release|Any CPU.Build.0 = Release|Any CPU 71 | {7EC5863F-7FF1-41C7-A384-8FFF81531E7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 72 | {7EC5863F-7FF1-41C7-A384-8FFF81531E7A}.Debug|Any CPU.Build.0 = Debug|Any CPU 73 | {7EC5863F-7FF1-41C7-A384-8FFF81531E7A}.Release|Any CPU.ActiveCfg = Release|Any CPU 74 | {7EC5863F-7FF1-41C7-A384-8FFF81531E7A}.Release|Any CPU.Build.0 = Release|Any CPU 75 | {AD91AAF5-3B57-4C8C-9A39-92FB578AF317}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 76 | {AD91AAF5-3B57-4C8C-9A39-92FB578AF317}.Debug|Any CPU.Build.0 = Debug|Any CPU 77 | {AD91AAF5-3B57-4C8C-9A39-92FB578AF317}.Release|Any CPU.ActiveCfg = Release|Any CPU 78 | {AD91AAF5-3B57-4C8C-9A39-92FB578AF317}.Release|Any CPU.Build.0 = Release|Any CPU 79 | EndGlobalSection 80 | GlobalSection(SolutionProperties) = preSolution 81 | HideSolutionNode = FALSE 82 | EndGlobalSection 83 | GlobalSection(NestedProjects) = preSolution 84 | {493B0482-572A-4465-BD52-4094351C2647} = {58E8143E-86D8-4CA3-AAC3-1CF253D91207} 85 | {4CFB2896-D5C1-4E96-A3DA-D57C58539209} = {58E8143E-86D8-4CA3-AAC3-1CF253D91207} 86 | {7238F90D-3BCE-4F40-A5BA-EA36AD484BD6} = {58E8143E-86D8-4CA3-AAC3-1CF253D91207} 87 | {CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2} = {93AD624B-85A6-4EE9-B40E-42914D40C0CF} 88 | {2AF89ACA-3545-432D-8D99-C5230E8643A8} = {93AD624B-85A6-4EE9-B40E-42914D40C0CF} 89 | {7EC5863F-7FF1-41C7-A384-8FFF81531E7A} = {58E8143E-86D8-4CA3-AAC3-1CF253D91207} 90 | {AD91AAF5-3B57-4C8C-9A39-92FB578AF317} = {93AD624B-85A6-4EE9-B40E-42914D40C0CF} 91 | EndGlobalSection 92 | GlobalSection(ExtensibilityGlobals) = postSolution 93 | SolutionGuid = {4853AD21-0DCE-40D8-A3B9-19081B71C364} 94 | EndGlobalSection 95 | EndGlobal 96 | -------------------------------------------------------------------------------- /MicrosoftAspNetSessionState.msbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | SessionStateModule is ASP.NET’s default session-state handler which retrieves session data and writes it to the session-state store. It already operates asynchronously when acquiring the request state, but it doesn’t support async read/write to the session-state store. In the .NET Framework 4.6.2 release, we introduced a new interface named ISessionStateModule to enable this scenario. You can find more details on [this blog post](https://blogs.msdn.microsoft.com/webdev/2016/09/29/introducing-the-asp-net-async-sessionstate-module/). 3 | 4 | ## How to build 5 | 1. Open a [VS developer command prompt](https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs) 6 | 2. Run build.cmd. This will build Nuget package and run all the unit tests. 7 | 3. All the build artifacts will be under aspnetsessionstate\bin\Release\ folder. 8 | 9 | ## How to contribute 10 | Information on contributing to this repo is in the [Contributing Guide](CONTRIBUTING.md). 11 | 12 | ## How to use 13 | 1. Update your web.config to remove the old session state module and register the new one: 14 | ```xml 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ``` 23 | 2. Add one of the new providers to the `` section of your web.config: 24 | ```xml 25 | 26 | 27 | 28 | 29 | 30 | ``` 31 | The specific settings available for the new session state module and providers are detailed in their respective doc pages. 32 | 33 | ## Module and Providers contained here 34 | - [Microsoft.AspNet.SessionState.SessionStateModule](docs/SessionStateModule.md) 35 | - [Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync](docs/SqlSessionStateProviderAsync.md) 36 | - [Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync](docs/CosmosDBSessionStateProviderAsync.md) 37 | 38 | 39 | ## V2.1 Updates: 40 | * New `ISessionStateItemCollection` implementations for concurrent access. The `SessionStateItemCollection` that comes in the framework is not thread-safe and can cause issues when multiple threads are trying to access the same session state, which is something that is allowed with this package and the `AllowConcurrentRequestsPerSession` setting. When this feature is enabled, the providers in this repo will use the new thread-safe implementations: `ConcurrentNonSerializingSessionStateItemCollection` for the In-Proc provider, since it does not need to serialize session state data, and `ConcurrentSessionStateItemCollection` for the SQL and CosmosDB providers, since they do need to serialize session state data. This latter implementation is as direct of a port from the .Net framework as possible while fixing the concurrency issue with the original implementaiton. 41 | ## V2.0 Updates: 42 | * :warning: ***Breaking Change*** - CosmosDB partition-related parameters are ignored. All containers use `/id` as the partition path now. Using an existing container with a different partition key path will result in exceptions. `partitionKeyPath` and `partitionNumUsedByProvider` are now ignored. 43 | > The original design around partition use in the CosmosDB provider was influenced by experience with the older SQL partition paradigms. There was an effort to enable them for scalability, but keep them reasonable for managability. In reality, CosmosDB encourages the use of as many "logical" partitions as can be used so long as they make sense. The complexity of managing and scaling is all handled magically by CosmosDB. 44 | > 45 | > The most logical partition field for session state is the session ID. The CosmosDB provider has been updated to alway use `"/id"` as the partition key path with the full session ID as the partition value. Pre-existing containers that use a different partition key path (which is any that opted into using partitions previously) will need to migrate to a container that uses `"/id"` as the partition key path. The data is all still good - although, the old partition key path can be dropped when migrating. There is unfortunately no way to simply update the partition key path on an existing container right now. [This blog post](https://devblogs.microsoft.com/cosmosdb/how-to-change-your-partition-key/) is a guide for migrating to a new container with the correct partition key path. 46 | * :warning: ***Potential Breaking Change*** - Added `managedHandler` precondition to module configuration. The old in-box session module used this and it is a reasonable default for avoiding traffic jams. It can be removed from web.config if session is required for non-managed handlers as well. 47 | * :warning: ***Action Required*** Sql provider `repositoryType` - This new setting provides a little more flexibility for repository configuration beyond a single boolean for in-memory optimized tables. Possible values are `SqlServer|InMemory|InMemoryDurable|FrameworkCompat`. Read about what each configuration is at our [SqlSessionStateProviderAsync](docs/SqlSessionStateProviderAsync.md) doc page. 48 | 49 | > The mechanics of nuget package upgrade results in removing old elements and re-adding the boiler-plate elements in configuration. To restore In-Memory functionality, set 'repositoryType' to `InMemory`. To continue using an existing non-memory-optimized table without stored procedures, set 'RespositoryType' to `FrameworkCompat`. The recommendation is to update to the new table schema and use stored procedures with `SqlServer`, but this will ignore existing sessions in previously existing tables. 50 | * Moved to use `Microsoft.Data.SqlClient` instead of old `System.Data.SqlClient`. This allows for more modern features such as Token Authorization. 51 | * Added `skipKeepAliveWhenUnused` to all providers. This setting will skip the call to update expiration time on requests that did not read or write session state. This is setting is used at the module level, and is thus exists on all providers. The default is "false" to maintain compatibility. But certain applications (like MVC) where there can be an abundance of requests processed that never even look at session state could benefit from setting this to "true" to reduce the use of and contention within the session state store. Setting this to "true" does mean that a session needs to be used (not necessarily updated, but at least requested/queried) to stay alive. 52 | * The Sql provider's `useInMemoryTable` is deprecated. It will continue to be respected in the absence of `repositoryType`, but is overridden by that setting if given. 53 | * Sql provider `sessionTableName` - A new setting that allows users to target a specific table in their database rather than being forced to use the default table names. 54 | * CosmosDB `collectionId` is now `containerId` in keeping with the updated terminology from the CosmosDB offering. Please use the updated parameter name when configuring your provider. (The old name will continue to work just the same.) 55 | * Added CosmosDB `consistencyLevel` to allow using a different [Consistency Level](https://learn.microsoft.com/en-us/azure/cosmos-db/consistency-levels) with the CosmosClient. 56 | * CosmosDB `connectionProtocol` is obsolete. It will not cause errors to have it in configuration, but it is ignored. The current [CosmosDB SDK chooses the protocol based on connection mode](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/sdk-connection-modes). 57 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | The .NET Core and ASP.NET Core support policy, including supported versions can be found at the [.NET Core Support Policy Page](https://dotnet.microsoft.com/platform/support/policy/dotnet-core). 6 | 7 | ## Reporting a Vulnerability 8 | 9 | Security issues and bugs should be reported privately to the Microsoft Security Response Center (MSRC), either by emailing secure@microsoft.com or via the portal at https://msrc.microsoft.com. 10 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your 11 | original message. Further information, including the MSRC PGP key, can be found in the [MSRC Report an Issue FAQ](https://www.microsoft.com/en-us/msrc/faqs-report-an-issue). 12 | 13 | Reports via MSRC may qualify for the .NET Core Bug Bounty. Details of the .NET Core Bug Bounty including terms and conditions are at [https://aka.ms/corebounty](https://aka.ms/corebounty). 14 | 15 | Please do not open issues for anything you think might have a security implication. 16 | -------------------------------------------------------------------------------- /azure-pipeline/azure-pipeline.yml: -------------------------------------------------------------------------------- 1 | # This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool. 2 | # Please make sure to check all the converted content, it is your team's responsibility to make sure that the pipeline is still valid and functions as expected. 3 | # The SBOM tasks have been removed because they are not required for the unofficial template. 4 | # You can manually enable SBOM in the unofficial template if needed, othewise its automatically enabled when using official template. https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/sbom 5 | # This pipeline will be extended to the MicroBuild template 6 | # The Task 'PublishBuildArtifacts@1' has been converted to an output named 'Publish Artifact: Nuget packages' in the templateContext section. 7 | trigger: none 8 | schedules: 9 | - cron: "0 0 14 * *" 10 | branches: 11 | include: 12 | - main 13 | always: true 14 | resources: 15 | repositories: 16 | - repository: self 17 | type: git 18 | ref: refs/heads/main 19 | - repository: MicroBuildTemplate 20 | type: git 21 | name: 1ESPipelineTemplates/MicroBuildTemplate 22 | ref: refs/tags/release 23 | name: $(Date:yyyyMMdd).$(Rev:r) 24 | variables: 25 | TeamName: Asp.Net 26 | EnableNuGetPackageRestore: true 27 | extends: 28 | template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate 29 | parameters: 30 | sdl: 31 | binskim: 32 | enable: true 33 | codeql: 34 | enable: true 35 | policheck: 36 | enable: true 37 | tsa: 38 | enable: true 39 | sourceAnalysisPool: 40 | name: AzurePipelines-EO 41 | image: 1ESPT-Windows2022 42 | os: windows 43 | customBuildTags: 44 | - ES365AIMigrationTooling 45 | stages: 46 | - stage: stage 47 | jobs: 48 | - job: Phase_1 49 | displayName: Phase 1 50 | timeoutInMinutes: 120 51 | cancelTimeoutInMinutes: 1 52 | pool: 53 | name: VSEngSS-MicroBuild2022-1ES 54 | templateContext: 55 | mb: 56 | signing: 57 | enabled: true 58 | signType: test 59 | zipSources: false 60 | outputs: 61 | - output: pipelineArtifact 62 | displayName: 'Publish Artifact: Nuget packages' 63 | artifactName: Nuget packages 64 | targetPath: $(Build.SourcesDirectory)\.binaries\Packages\Release 65 | sbomEnabled: true 66 | sbomBuildDropPath: $(Build.SourcesDirectory)\.binaries\Packages\Release 67 | sbomBuildComponentPath: $(Build.SourcesDirectory)\.binaries\Packages\Release 68 | sbomPackageName: Microsoft.AspNet.OutputCache 69 | # sbomPackageVersion: $(NugetPackageVersion) 70 | sbomValidate: true 71 | steps: 72 | - checkout: self 73 | clean: true 74 | fetchTags: true 75 | persistCredentials: true 76 | - task: NuGetToolInstaller@0 77 | displayName: Use NuGet 5.4.0 78 | inputs: 79 | versionSpec: 5.4.0 80 | checkLatest: true 81 | - task: NuGetCommand@2 82 | displayName: NuGet custom 83 | inputs: 84 | command: custom 85 | arguments: install MicroBuild.Core -version 0.3.0 -OutputDirectory .\packages -source https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json 86 | - task: NuGetCommand@2 87 | displayName: NuGet restore 88 | inputs: 89 | solution: Microsoft.Aspnet.SessionState.sln 90 | - task: MSBuild@1 91 | displayName: Build solution MicrosoftAspNetSessionState.msbuild 92 | inputs: 93 | solution: MicrosoftAspNetSessionState.msbuild 94 | msbuildVersion: 17.0 95 | msbuildArchitecture: x64 96 | configuration: Release 97 | msbuildArguments: /p:GitCommit=$(Build.SourceVersion) /p:GitCommitLink="https://github.com/aspnet/AspNetSessionState/commit/$(Build.SourceVersion)" /p:SignType=real /p:SignAssembly=true /verbosity:normal 98 | clean: true 99 | createLogFile: true 100 | logFileVerbosity: detailed 101 | timeoutInMinutes: 120 102 | - task: CopyFiles@2 103 | displayName: Stage dll's for verification 104 | inputs: 105 | SourceFolder: $(Build.SourcesDirectory)\.binaries\bin\Release 106 | Contents: Microsoft.AspNet.SessionState.*.dll 107 | TargetFolder: $(Build.SourcesDirectory)\.binaries\verify\dlls 108 | CleanTargetFolder: true 109 | OverWrite: true 110 | - task: CopyFiles@2 111 | displayName: Stage nupkg's for verification 112 | inputs: 113 | SourceFolder: $(Build.SourcesDirectory)\.binaries\Packages\Release 114 | Contents: | 115 | Microsoft.AspNet.SessionState.*.nupkg 116 | !*.symbols.nupkg 117 | TargetFolder: $(Build.SourcesDirectory)\.binaries\verify\packages 118 | CleanTargetFolder: true 119 | OverWrite: true 120 | - task: ms-vseng.MicroBuildShipTasks.7c429315-71ba-4cb3-94bb-f829c95f7915.MicroBuildCodesignVerify@1 121 | displayName: Verify Signed Binaries 122 | inputs: 123 | TargetFolder: $(Build.SourcesDirectory)\.binaries\verify\dlls 124 | ExcludeFolders: .git MicroBuild apiscan 125 | - task: ms-vseng.MicroBuildShipTasks.7c429315-71ba-4cb3-94bb-f829c95f7915.MicroBuildCodesignVerify@1 126 | displayName: Verify Signed Packages 127 | inputs: 128 | TargetFolder: $(Build.SourcesDirectory)\.binaries\verify\packages 129 | WhiteListPathForCerts: $(Build.SourcesDirectory)\tools\.verif.whitelist 130 | ExcludeFolders: .git MicroBuild decomp *.xml 131 | # Following article on https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/25351/APIScan-step-by-step-guide-to-setting-up-a-Pipeline 132 | # No longer need the old format, and following guideline to use (ApiScanClientId) 133 | - task: APIScan@2 134 | displayName: Run APIScan 135 | inputs: 136 | softwareFolder: '$(Build.SourcesDirectory)\.binaries\verify\dlls' 137 | softwareName: 'Microsoft.AspNet.SessionState' 138 | softwareVersionNum: '*' 139 | softwareBuildNum: '$(Build.BuildId)' 140 | symbolsFolder: '$(Build.SourcesDirectory)\.binaries\bin\Release;SRV*http://symweb' 141 | verbosityLevel: 'none' 142 | env: 143 | AzureServicesAuthConnectionString: RunAs=App;AppId=$(ApiScanClientId) -------------------------------------------------------------------------------- /build.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | setlocal 4 | set EnableNuGetPackageRestore=true 5 | 6 | set MSBUILDEXE=msbuild.exe 7 | 8 | set cfgOption=/p:Configuration=Release 9 | REM set cfgOption=/p:Configuration=Debug 10 | REM set cfgOption=/p:Configuration=Debug;Release 11 | if not "%1"=="" set cfgOption=/p:Configuration= 12 | 13 | set logOptions=/v:n /flp:Summary;Verbosity=diag;LogFile=msbuild.log /flp1:warningsonly;logfile=msbuild.wrn /flp2:errorsonly;logfile=msbuild.err 14 | 15 | echo Please build from VS 2015(or newer version) Developer Command Prompt 16 | 17 | :BUILD 18 | %MSBUILDEXE% "%~dp0\MicrosoftAspNetSessionState.msbuild" /t:BuildAll %logOptions% /maxcpucount /nodeReuse:false /p:SkipAdvancedTests=True %cfgOption%%* 19 | 20 | endlocal 21 | -------------------------------------------------------------------------------- /clean.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | setlocal 4 | 5 | set MSBUILDEXE=msbuild.exe 6 | 7 | set cfgOption=/p:Configuration=Release 8 | REM set cfgOption=/p:Configuration=Debug 9 | REM set cfgOption=/p:Configuration=Debug;Release 10 | if not "%1"=="" set cfgOption=/p:Configuration= 11 | 12 | set logOptions=/v:n /flp:Summary;Verbosity=diag;LogFile=msbuild.log /flp1:warningsonly;logfile=msbuild.wrn /flp2:errorsonly;logfile=msbuild.err 13 | 14 | echo Please build from VS 2015(or newer version) Developer Command Prompt 15 | 16 | :BUILD 17 | %MSBUILDEXE% "%~dp0\MicrosoftAspNetSessionState.msbuild" /t:Clean %logOptions% /maxcpucount /nodeReuse:false %cfgOption%%* 18 | del /F msbuild.* 19 | del /F msbuild.wrn 20 | del /F msbuild.err 21 | 22 | endlocal 23 | -------------------------------------------------------------------------------- /docs/CosmosDBSessionStateProviderAsync.md: -------------------------------------------------------------------------------- 1 | # Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync 2 | In .Net 4.6.2, asp.net enables developer plug in async version of SessionState module which is a good fit for the non-in-memory SessionState data store. This SessionState provider uses SQL Server as the data store and leverages async database operation to provide better scability. 3 | 4 | Before you can specify this new async providers, you need to setup the new async SessionStateModule as [described here](https://github.com/aspnet/AspNetSessionState/blob/main/docs/SessionStateModule.md). 5 | 6 | Then, register your new provider like so: 7 | ```xml 8 | 9 | 10 | 14 | 15 | 16 | ``` 17 | > **Note** 18 | > For the best scalability, it is recommended to configure your CosmosDB provider with "wildcard" partitioning. For update-compatibility purposes, this is not the default. Please read about *partitionKeyPath* and *partitionNumUsedByProvider* below. 19 | 20 | ## Settings for Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync 21 | 1. *cosmosDBEndPointSettingKey* - The appsetting key name which points to a CosmosDB end point 22 | 23 | 2. *cosmosDBAuthKeySettingKey* - The appsetting key name which points to a CosmosDB auth key 24 | 25 | 3. *offerThroughput* - The offer throughput provisioned for a collection in measurement of Requests-per-Unit in the Azure DocumentDB database service. If the collection provided doesn't exist, the provider will create a collection with this offerThroughput. If set to "0", collection will be set to use the default throughput of the database. 26 | 27 | 4. *connectionMode* - Direct | Gateway 28 | 29 | 5. *requestTimeout* - The request timeout in seconds when connecting to the Azure DocumentDB database service. 30 | 31 | 6. *skipKeepAliveWhenUnused* - This setting will skip the call to update expiration time on requests that did not read or write session state. The default is "false" to maintain compatibility with previous behavior. But certain applications (like MVC) where there can be an abundance of requests processed that never even look at session state could benefit from setting this to "true" to reduce the use of and contention within the session state store. Setting this to "true" does mean that a session needs to be used (not necessarily updated, but at least requested/queried) to stay alive. 32 | 33 | 7. *maxConnectionLimit* - maximum number of concurrent connections allowed for the target service endpoint in the Azure DocumentDB database service. 34 | 35 | 8. *maxRetryAttemptsOnThrottledRequests* - the maximum number of retries in the case where the request fails because the Azure DocumentDB database service has applied rate limiting on the client. 36 | 37 | 9. *maxRetryWaitTimeInSeconds* - The maximum retry time in seconds for the Azure DocumentDB database service. 38 | 39 | 10. *consistencyLevel* - The [Consistency Level](https://learn.microsoft.com/en-us/azure/cosmos-db/consistency-levels) to use with the CosmosClient. Default is the Cosmos SDK default, which is currently 'Session'. 40 | 41 | 11. *preferredLocations* - Sets the preferred locations(regions) for geo-replicated database accounts in the Azure DocumentDB database service. Use ';' to split multiple locations. e.g. "East US;South Central US;North Europe" 42 | -------------------------------------------------------------------------------- /docs/SessionStateModule.md: -------------------------------------------------------------------------------- 1 | # Microsoft.AspNet.SessionState.SessionStateModule 2 | SessionStateModule is ASP.NET’s default session-state handler which retrieves session data and writes it to the session-state store. It already operates asynchronously when acquiring the request state, but it doesn’t support async read/write to the session-state store. In the .NET Framework 4.6.2 release, we introduced a new interface named ISessionStateModule to enable this scenario. You can find more details on [this blog post](https://blogs.msdn.microsoft.com/webdev/2016/09/29/introducing-the-asp-net-async-sessionstate-module/). 3 | 4 | Before you can specify one of these custom providers. You need to remove the existing session state module from your web.config file. In addition, you must register the new module to take its place. 5 | 6 | ```xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | ``` 15 | 16 | ## Settings of Microsoft.AspNet.SessionState.SessionStateModule 17 | 18 | 1. appSetting *aspnet:RequestQueueLimitPerSession* 19 | 20 | *How to use* - Add `````` into web.config under appSettings section. 21 | 22 | *Description* - If multiple requests with same sessionid try to acquire sessionstate concurrently, asp.net only allows one request to get the sessionstate. This causes performance issues if there are too many requests with same sessionid and a request doesn't release sessionstate fast enough, as asp.net starts a timer for each of this request to acquire sessionstate every 0.5 sec by default. This is even worse, if out-proc sessionstate provider is used. Because this can potentially use most of the out-proc storage connection resources. With this setting, asp.net will ends the request after the number of concurrent requests with same sessionid reaches the configured number. 23 | 24 | 2. appSetting *aspnet:AllowConcurrentRequestsPerSession* 25 | 26 | *How to use* - Add `````` into web.config under appSettings section. 27 | 28 | *Description* - If multiple requests with same sessionid try to acquire sessionstate concurrently, asp.net only allows one request to get the sessionstate. With this setting, asp.net will allow multiple requests with same sessionid to acquire the sessionstate, but it doesn't guarantee thread safe of accessing sessionstate. 29 | -------------------------------------------------------------------------------- /docs/SqlSessionStateProviderAsync.md: -------------------------------------------------------------------------------- 1 | # Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync 2 | In .Net 4.6.2, asp.net enables developer plug in async version of SessionState module which is a good fit for the non-in-memory SessionState data store. This SessionState provider uses SQL Server as the data store and leverages async database operation to provide better scability. 3 | 4 | Before you can specify this new async providers, you need to setup the new async SessionStateModule as [described here](https://github.com/aspnet/AspNetSessionState/blob/main/docs/SessionStateModule.md). 5 | 6 | Then, register your new provider like so: 7 | ```xml 8 | 9 | 10 | 14 | 15 | 16 | ``` 17 | 18 | ## A Note About Tables and Data Durability 19 | The old in-box SQL provider allowed for applications to choose between three data configurations by using the `-sstype` argument to `aspnet_regsql.exe`. Those types were *p*ermanent, *t*emporary, or *c*ustom. The difference between all three is simply the database and table name used by `aspnet_regsql.exe` and the application at runtime. 20 | * With the permanent option, session state would be stored in a hard-coded well-known table name in the database specified by the connection string. The table schema and data are "permanent" in this setup because they survive SQL server reboot. 21 | * With the temporary option, session state would be stored in a hard-coded well-known table name in the "tempdb" database on the SQL Server specified in the connection string. The "tempdb" database gets cleared upon SQL server reboot, so the data is not kept. The table schema and stored procedures are also cleared in this scenario, but there is a startup procedure that gets registered to re-create session state tables and stored procedures. 22 | * With the custom option, session state would be stored in a table name given by the developer/administrator. The stored procedures created in the database work against that custom table name. 23 | 24 | With this new provider, `aspnet_regsql.exe` is no longer required. (Although, compatibility with stores created by 'aspnet_regsql.exe' can be found when using 'repositoryType=FrameworkCompat'.) When using a `SqlServer` 'repositoryType' the provider will automatically create tables and stored procedures if they don't already exist. By default, that table name is "hard-coded and well-known" - though it has changed from previous versions to avoid inadvertent compatibility problems. You can change that table name by using the 'sessionTableName' attribute on the provider. Whether or not data is 'temporary' or 'permanent' in this type of repository depends entirely on the connection string used. If the connection string indicates using "tempdb", then the data will be temporary. If it indicates a non-temporary initial database, then the data will survive SQL reboots. 25 | 26 | When using a Memory-Optimized 'repositoryType' however, data durability is determined by the optimized table schema. Thus, the provider needs to know what settings to apply to any table it creates. If you want permanent data that survives SQL Server reboots, you must use `InMemoryDurable`. 27 | 28 | ## Settings for Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync 29 | 1. *repositoryType* - One of four values. The default is 'FrameworkCompat' for compatibility reasons - unless the deprecated 'useInMemoryTable' is also set to true, then the default repository type becomes 'InMemory'. 30 | * `SqlServer` - Use this option to use a regular SQL server configuration for a fresh deployment. This configuration will create a session table and associated stored procedures if they don't already exist. (*Note* - the session table expected/created in by this repository type uses a different data type for storing state, and is thus incompatible with the 1.1 release of this provider.) 31 | * `InMemory` - Use this option to leverage "[In-Memory Optimized Tables](https://learn.microsoft.com/en-us/sql/relational-databases/in-memory-oltp/introduction-to-memory-optimized-tables?view=sql-server-ver16)" with "[Natively Compiled Stored Procedures](https://learn.microsoft.com/en-us/sql/relational-databases/in-memory-oltp/a-guide-to-query-processing-for-memory-optimized-tables?view=sql-server-ver16)". New in version 2.0, we create natively compiled stored procedures to go along with the memory-optimized table for an additional performance boost. (V1.1 did not use stored procedures at all.) Tables are durable, but the data is not (`SCHEMA_ONLY`) and will be lost on SQL Server restarts. 32 | * `InMemoryDurable` - The same as above, except with a `SCHEMA_AND_DATA` durable table so session data survives a SQL Server restart. 33 | * `FrameworkCompat` - This mode was introduced to use existing session state databases that were provisioned by `aspnet_regsql.exe`. As such, it does not create any new tables or stored procedures. It does leverage the same stored procedures that are used by the in-box SQL Session State provider. 34 | 35 | This compat configuration ***also*** handles going against a database that was previously configured by V1.1 of these providers, since the current table schema is not fully compatible with the 1.1 table schema. When working against a 1.1-deployed session table, this repository continues to use raw SQL statements instead of stored procedures just like the V1.1 provider did. 36 | 37 | The provider automatically decides between Framework and V1.1 compat modes in this configuration. 38 | 39 | 2. *sessionTableName* - The provider now allows the flexibility to use a particular table name for storing session instead of always using the hard-coded default. 40 | 41 | 3. *maxRetryNumber* - The maximum number of retrying executing sql query to read/write sessionstate data from/to Sql server. The default value is 10. 42 | 43 | 4. *retryInterval* - The interval between the retry of executing sql query. The default value is 0.001 sec for in-memorytable mode. Otherwise the default value is 1 sec. 44 | 45 | 5. *skipKeepAliveWhenUnused* - This setting will skip the call to update expiration time on requests that did not read or write session state. The default is "false" to maintain compatibility with previous behavior. But certain applications (like MVC) where there can be an abundance of requests processed that never even look at session state could benefit from setting this to "true" to reduce the use of and contention within the session state store. Setting this to "true" does mean that a session needs to be used (not necessarily updated, but at least requested/queried) to stay alive. 46 | 47 | 6. **[Deprecated]** *useInMemoryTable* - In the absence of a value for `repositoryType`, this setting will be used to determine whether to use Sql server 2016 In-Memory OLTP for sessionstate. However, if `repositoryType` is specified, that setting takes priority. You can find more details about using In-memory table for sessionstate [on this blog](https://blogs.msdn.microsoft.com/sqlcat/2016/10/26/how-bwin-is-using-sql-server-2016-in-memory-oltp-to-achieve-unprecedented-performance-and-scale/). 48 | -------------------------------------------------------------------------------- /src/CosmosDBSessionStateProviderAsync/Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {4CFB2896-D5C1-4E96-A3DA-D57C58539209} 9 | Library 10 | Properties 11 | Microsoft.AspNet.SessionStateCosmosDBSessionStateProviderAsync 12 | Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync 13 | v4.6.2 14 | 512 15 | 16 | $(OutputPath)$(AssemblyName).xml 17 | ..\..\ 18 | 19 | 20 | 21 | 22 | true 23 | full 24 | false 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | ..\obj\ 29 | 30 | 31 | portable 32 | true 33 | TRACE 34 | prompt 35 | 4 36 | ..\obj\ 37 | 38 | 39 | true 40 | 41 | 42 | $(RepositoryRoot)tools\35MSSharedLib1024.snk 43 | 44 | 45 | true 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | True 74 | True 75 | SR.resx 76 | 77 | 78 | 79 | 80 | 81 | {7238f90d-3bce-4f40-a5ba-ea36ad484bd6} 82 | Microsoft.AspNet.SessionState.SessionStateModule 83 | 84 | 85 | 86 | 87 | ResXFileCodeGenerator 88 | SR.Designer.cs 89 | 90 | 91 | 92 | 93 | 3.46.1 94 | 95 | 110 | 111 | 13.0.1 112 | 113 | 114 | 8.0.5 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /src/CosmosDBSessionStateProviderAsync/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices; 7 | 8 | // General Information about an assembly is controlled through the following 9 | // set of attributes. Change these attribute values to modify the information 10 | // associated with an assembly. 11 | [assembly: AssemblyTitle("Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync")] 12 | [assembly: AssemblyDescription("Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.dll")] 13 | [assembly: AssemblyConfiguration("")] 14 | [assembly: AssemblyCompany("Microsoft Corporation")] 15 | [assembly: AssemblyProduct("Microsoft AspNet Async CosmosDBSessionStateProvider")] 16 | [assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | 20 | // Setting ComVisible to false makes the types in this assembly not visible 21 | // to COM components. If you need to access a type in this assembly from 22 | // COM, set the ComVisible attribute to true on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The following GUID is for the ID of the typelib if this project is exposed to COM 26 | [assembly: Guid("4cfb2896-d5c1-4e96-a3da-d57c58539209")] 27 | [assembly: InternalsVisibleTo("Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] 28 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] 29 | -------------------------------------------------------------------------------- /src/CosmosDBSessionStateProviderAsync/Resources/SR.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Microsoft.AspNet.SessionState.Resources { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class SR { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal SR() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AspNet.SessionStateCosmosDBSessionStateProviderAsync.Resources.SR", typeof(SR).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Parameter '{0}' cannot be null.. 65 | /// 66 | internal static string ArgumentNull_WithParamName { 67 | get { 68 | return ResourceManager.GetString("ArgumentNull_WithParamName", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to The specified container '{0}' already exists with a partition key path other than '{1}'.. 74 | /// 75 | internal static string Container_PKey_Does_Not_Match { 76 | get { 77 | return ResourceManager.GetString("Container_PKey_Does_Not_Match", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to Configuration '{0}' cannot be null.. 83 | /// 84 | internal static string EmptyConfig_WithName { 85 | get { 86 | return ResourceManager.GetString("EmptyConfig_WithName", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to The session state information is invalid and might be corrupted.. 92 | /// 93 | internal static string Invalid_session_state { 94 | get { 95 | return ResourceManager.GetString("Invalid_session_state", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to The request rate to CosmosDB is too large. You may consider to increase the offer throughput of the CosmosDB collection or increase maxRetryAttemptsOnThrottledRequests and maxRetryWaitTimeInSeconds settings in web.config. 101 | /// 102 | internal static string Request_To_CosmosDB_Is_Too_Large { 103 | get { 104 | return ResourceManager.GetString("Request_To_CosmosDB_Is_Too_Large", resourceCulture); 105 | } 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/CosmosDBSessionStateProviderAsync/Resources/SR.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Parameter '{0}' cannot be null. 122 | 123 | 124 | The specified container '{0}' already exists with a partition key path other than '{1}'. 125 | 126 | 127 | Configuration '{0}' cannot be null. 128 | 129 | 130 | The session state information is invalid and might be corrupted. 131 | 132 | 133 | The request rate to CosmosDB is too large. You may consider to increase the offer throughput of the CosmosDB collection or increase maxRetryAttemptsOnThrottledRequests and maxRetryWaitTimeInSeconds settings in web.config 134 | 135 | -------------------------------------------------------------------------------- /src/CosmosDBSessionStateProviderAsync/SessionStateActionsConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState { 5 | using System; 6 | using System.Web.SessionState; 7 | using System.Text.Json; 8 | using System.Text.Json.Serialization; 9 | 10 | class SessionStateActionsConverter : JsonConverter 11 | { 12 | public override bool CanConvert(Type typeToConvert) 13 | { 14 | return typeof(SessionStateActions?) == typeToConvert; 15 | } 16 | 17 | public override SessionStateActions? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 18 | { 19 | if (reader.TokenType == JsonTokenType.Null) 20 | { 21 | return new Nullable(); 22 | } 23 | 24 | if (reader.TokenType != JsonTokenType.True && reader.TokenType != JsonTokenType.False) 25 | { 26 | throw new ArgumentException("reader"); 27 | } 28 | 29 | // See the note below in the writer for how to map this flags enum from a boolean. 30 | return reader.GetBoolean() ? SessionStateActions.InitializeItem : SessionStateActions.None; 31 | } 32 | 33 | public override void Write(Utf8JsonWriter writer, SessionStateActions? action, JsonSerializerOptions options) 34 | { 35 | if (action == null) 36 | { 37 | writer.WriteNullValue(); 38 | return; 39 | } 40 | 41 | // SessionStateActions is a [Flags] enum. The SQL providers serialize it as flags. I don't know why we didn't 42 | // just go with int or something flag-like here instead of true/false. 43 | // 'None' means that the initialization of this state item has already been done and 44 | // thus the item is considered initialized. We serialize this item with the field name 45 | // "uninitialized", so 'None' should map to false. 46 | writer.WriteBooleanValue((action != SessionStateActions.None)); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/CosmosDBSessionStateProviderAsync/SessionStateItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState 5 | { 6 | using System; 7 | using System.Web.SessionState; 8 | using System.Text.Json.Serialization; 9 | 10 | class SessionStateItem 11 | { 12 | [JsonPropertyName("id")] 13 | [JsonRequired] 14 | public string SessionId { get; set; } 15 | 16 | // in second 17 | [JsonPropertyName("lockAge")] 18 | [JsonConverter(typeof(TimeSpanConverter))] 19 | public TimeSpan? LockAge { get; set; } 20 | 21 | [JsonPropertyName("lockCookie")] 22 | public int? LockCookie { get; set; } 23 | 24 | //in sec 25 | // Leverage CosmosDB's TTL function to remove expired sessionstate item 26 | //ref https://docs.microsoft.com/en-us/azure/cosmos-db/time-to-live 27 | [JsonPropertyName("ttl")] 28 | public int? Timeout { get; set; } 29 | 30 | [JsonPropertyName("locked")] 31 | public bool? Locked { get; set; } 32 | 33 | [JsonPropertyName("sessionItem")] 34 | public byte[] SessionItem { get; set; } 35 | 36 | [JsonPropertyName("uninitialized")] 37 | [JsonConverter(typeof(SessionStateActionsConverter))] 38 | public SessionStateActions? Actions {get;set;} 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/CosmosDBSessionStateProviderAsync/SystemTextJsonSerializer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState 5 | { 6 | using Microsoft.Azure.Cosmos; 7 | using System.IO; 8 | using System.Text.Json; 9 | 10 | internal class SystemTextJsonSerializer : CosmosSerializer 11 | { 12 | private JsonSerializerOptions _opts; 13 | 14 | public SystemTextJsonSerializer(JsonSerializerOptions jsonSerializerOptions) 15 | { 16 | _opts = jsonSerializerOptions ?? default(JsonSerializerOptions); 17 | } 18 | 19 | public override T FromStream(Stream stream) 20 | { 21 | using (stream) 22 | { 23 | if (stream.CanSeek 24 | && stream.Length == 0) 25 | { 26 | return default; 27 | } 28 | 29 | if (typeof(Stream).IsAssignableFrom(typeof(T))) 30 | { 31 | return (T)(object)stream; 32 | } 33 | 34 | return JsonSerializer.Deserialize(stream, _opts); 35 | } 36 | } 37 | 38 | public override Stream ToStream(T input) 39 | { 40 | MemoryStream ms = new MemoryStream(); 41 | JsonSerializer.Serialize(ms, input, input.GetType(), _opts); 42 | ms.Position = 0; 43 | return ms; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/CosmosDBSessionStateProviderAsync/TimeSpanConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState 5 | { 6 | using System; 7 | using System.Text.Json; 8 | using System.Text.Json.Serialization; 9 | using Microsoft.AspNet.SessionState.Resources; 10 | 11 | class TimeSpanConverter : JsonConverter 12 | { 13 | public override bool CanConvert(Type typeToConvert) 14 | { 15 | return typeof(TimeSpan?) == typeToConvert; 16 | } 17 | 18 | public override TimeSpan? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 19 | { 20 | if (reader.TokenType == JsonTokenType.Null) 21 | { 22 | return new Nullable(); 23 | } 24 | 25 | if (reader.TokenType != JsonTokenType.Number) 26 | { 27 | throw new ArgumentException("reader"); 28 | } 29 | 30 | return new TimeSpan(0, 0, reader.GetInt32()); 31 | } 32 | 33 | public override void Write(Utf8JsonWriter writer, TimeSpan? value, JsonSerializerOptions options) 34 | { 35 | if (value == null) 36 | { 37 | writer.WriteNullValue(); 38 | return; 39 | } 40 | 41 | var ts = (TimeSpan)value; 42 | writer.WriteNumberValue((int)ts.TotalSeconds); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/SessionStateModule/AppSettings.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState 5 | { 6 | using System.Collections.Specialized; 7 | using System.Web.Configuration; 8 | 9 | static class AppSettings 10 | { 11 | private static volatile bool _settingsInitialized; 12 | private static object _lock = new object(); 13 | 14 | private static void LoadSettings(NameValueCollection appSettings) 15 | { 16 | // 17 | // RequestQueueLimitPerSession 18 | // 19 | string requestQueueLimit = appSettings["aspnet:RequestQueueLimitPerSession"]; 20 | 21 | if (!int.TryParse(requestQueueLimit, out _requestQueueLimitPerSession) || _requestQueueLimitPerSession < 0) 22 | { 23 | _requestQueueLimitPerSession = DefaultRequestQueueLimitPerSession; 24 | } 25 | 26 | // 27 | // AllowConcurrentRequests 28 | // 29 | string allowConcurrentRequestPerSession = appSettings["aspnet:AllowConcurrentRequestsPerSession"]; 30 | bool.TryParse(allowConcurrentRequestPerSession, out _allowConcurrentRequestsPerSession); 31 | } 32 | 33 | private static void EnsureSettingsLoaded() 34 | { 35 | if (_settingsInitialized) 36 | { 37 | return; 38 | } 39 | 40 | lock (_lock) 41 | { 42 | if (!_settingsInitialized) 43 | { 44 | try 45 | { 46 | LoadSettings(WebConfigurationManager.AppSettings); 47 | } 48 | finally 49 | { 50 | _settingsInitialized = true; 51 | } 52 | } 53 | } 54 | } 55 | 56 | // 57 | // RequestQueueLimitPerSession 58 | // Limit of queued requests per session 59 | // 60 | public const int DefaultRequestQueueLimitPerSession = 50; 61 | private static int _requestQueueLimitPerSession = DefaultRequestQueueLimitPerSession; 62 | 63 | public static int RequestQueueLimitPerSession 64 | { 65 | get 66 | { 67 | EnsureSettingsLoaded(); 68 | return _requestQueueLimitPerSession; 69 | } 70 | } 71 | 72 | private static bool _allowConcurrentRequestsPerSession = false; 73 | public static bool AllowConcurrentRequestsPerSession 74 | { 75 | get 76 | { 77 | EnsureSettingsLoaded(); 78 | return _allowConcurrentRequestsPerSession; 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/SessionStateModule/Microsoft.AspNet.SessionState.SessionStateModule.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {7238F90D-3BCE-4F40-A5BA-EA36AD484BD6} 9 | Library 10 | Properties 11 | Microsoft.AspNet.SessionState 12 | Microsoft.AspNet.SessionState.SessionStateModule 13 | v4.6.2 14 | 512 15 | 16 | $(OutputPath)$(AssemblyName).xml 17 | ..\..\ 18 | 19 | 20 | true 21 | full 22 | false 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | ..\obj\ 27 | 28 | 29 | portable 30 | true 31 | TRACE 32 | prompt 33 | 4 34 | ..\obj\ 35 | 36 | 37 | true 38 | 39 | 40 | $(RepositoryRoot)tools\35MSSharedLib1024.snk 41 | 42 | 43 | true 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | True 64 | True 65 | SR.resx 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | ResXFileCodeGenerator 78 | SR.Designer.cs 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /src/SessionStateModule/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices; 7 | 8 | // General Information about an assembly is controlled through the following 9 | // set of attributes. Change these attribute values to modify the information 10 | // associated with an assembly. 11 | [assembly: AssemblyTitle("Microsoft.AspNet.SessionState.SessionStateModule.dll")] 12 | [assembly: AssemblyDescription("Microsoft.AspNet.SessionState.SessionStateModule.dll")] 13 | [assembly: AssemblyConfiguration("")] 14 | [assembly: AssemblyCompany("Microsoft Corporation")] 15 | [assembly: AssemblyProduct("Microsoft AspNet SessionStateModule")] 16 | [assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | 20 | // Setting ComVisible to false makes the types in this assembly not visible 21 | // to COM components. If you need to access a type in this assembly from 22 | // COM, set the ComVisible attribute to true on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The following GUID is for the ID of the typelib if this project is exposed to COM 26 | [assembly: Guid("7238f90d-3bce-4f40-a5ba-ea36ad484bd6")] 27 | -------------------------------------------------------------------------------- /src/SessionStateModule/Resources/SR.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Microsoft.AspNet.SessionState.Resources { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class SR { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal SR() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AspNet.SessionState.Resources.SR", typeof(SR).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Unable to serialize the session state. For out-of-proc session stores, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted.. 65 | /// 66 | internal static string Cant_serialize_session_state { 67 | get { 68 | return ResourceManager.GetString("Cant_serialize_session_state", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to Error occured when reading config secion '{0}'.. 74 | /// 75 | internal static string Error_Occured_Reading_Config_Secion { 76 | get { 77 | return ResourceManager.GetString("Error_Occured_Reading_Config_Secion", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to The value for the '{0}' option on provider name '{1}' is invalid.. 83 | /// 84 | internal static string Invalid_provider_option { 85 | get { 86 | return ResourceManager.GetString("Invalid_provider_option", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to The custom session state store provider name '{0}' is invalid.. 92 | /// 93 | internal static string Invalid_session_custom_provider { 94 | get { 95 | return ResourceManager.GetString("Invalid_session_custom_provider", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to The session state information is invalid and might be corrupted.. 101 | /// 102 | internal static string Invalid_session_state { 103 | get { 104 | return ResourceManager.GetString("Invalid_session_state", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to The custom session state store provider '{0}' is not found.. 110 | /// 111 | internal static string Missing_session_custom_provider { 112 | get { 113 | return ResourceManager.GetString("Missing_session_custom_provider", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// Looks up a localized string similar to SessionStateAsync module only supports InProc and Custom mode.. 119 | /// 120 | internal static string Not_Support_SessionState_Mode { 121 | get { 122 | return ResourceManager.GetString("Not_Support_SessionState_Mode", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// Looks up a localized string similar to The SessionStateStoreData returned by ISessionStateStore has a null value for Items.. 128 | /// 129 | internal static string Null_value_for_SessionStateItemCollection { 130 | get { 131 | return ResourceManager.GetString("Null_value_for_SessionStateItemCollection", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// Looks up a localized string similar to The request queue limit of the session is exceeded.. 137 | /// 138 | internal static string Request_Queue_Limit_Per_Session_Exceeded { 139 | get { 140 | return ResourceManager.GetString("Request_Queue_Limit_Per_Session_Exceeded", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// Looks up a localized string similar to SessionId is too long.. 146 | /// 147 | internal static string Session_id_too_long { 148 | get { 149 | return ResourceManager.GetString("Session_id_too_long", resourceCulture); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized string similar to Type '{0}' does not inherit from '{1}'.. 155 | /// 156 | internal static string Type_doesnt_inherit_from_type { 157 | get { 158 | return ResourceManager.GetString("Type_doesnt_inherit_from_type", resourceCulture); 159 | } 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /src/SessionStateModule/Resources/SR.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Unable to serialize the session state. For out-of-proc session stores, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. 122 | 123 | 124 | Error occured when reading config secion '{0}'. 125 | 126 | 127 | The value for the '{0}' option on provider name '{1}' is invalid. 128 | 129 | 130 | The custom session state store provider name '{0}' is invalid. 131 | 132 | 133 | The session state information is invalid and might be corrupted. 134 | 135 | 136 | The custom session state store provider '{0}' is not found. 137 | 138 | 139 | SessionStateAsync module only supports InProc and Custom mode. 140 | 141 | 142 | The SessionStateStoreData returned by ISessionStateStore has a null value for Items. 143 | 144 | 145 | The request queue limit of the session is exceeded. 146 | 147 | 148 | SessionId is too long. 149 | 150 | 151 | Type '{0}' does not inherit from '{1}'. 152 | 153 | -------------------------------------------------------------------------------- /src/SessionStateModule/SessionEventSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState 5 | { 6 | using System; 7 | using System.Diagnostics.Tracing; 8 | using System.Web; 9 | 10 | [EventSource(Guid = "e195a708-06d5-4605-bbfe-818c9ff8e124", 11 | Name = "Microsoft-AspNet-SessionState-SessionStateModule")] 12 | class SessionEventSource : EventSource 13 | { 14 | private SessionEventSource() 15 | { 16 | } 17 | 18 | public static SessionEventSource Log { get; } = new SessionEventSource(); 19 | 20 | [NonEvent] 21 | public void SessionDataBegin(HttpContext context) 22 | { 23 | if (IsEnabled() && context != null) 24 | { 25 | RaiseEvent(SessionDataBegin, context); 26 | } 27 | } 28 | 29 | [Event(42, Level = EventLevel.Informational, Keywords = Keywords.AspNetReq)] 30 | private void SessionDataBegin(Guid contextId) 31 | { 32 | WriteEvent(EventType.SessionDataBegin, contextId); 33 | } 34 | 35 | [NonEvent] 36 | public void SessionDataEnd(HttpContext context) 37 | { 38 | if (IsEnabled()) 39 | { 40 | RaiseEvent(SessionDataEnd, context); 41 | } 42 | } 43 | 44 | 45 | [Event(43, Level = EventLevel.Informational, Keywords = Keywords.AspNetReq)] 46 | private void SessionDataEnd(Guid contextId) 47 | { 48 | if (IsEnabled()) 49 | { 50 | WriteEvent(EventType.SessionDataEnd, contextId); 51 | } 52 | } 53 | 54 | [NonEvent] 55 | private void RaiseEvent(Action action, HttpContext context) 56 | { 57 | HttpWorkerRequest workerRequest = GetWorkerRequest(context); 58 | if (workerRequest == null) 59 | return; 60 | 61 | action(workerRequest.RequestTraceIdentifier); 62 | } 63 | 64 | [NonEvent] 65 | private HttpWorkerRequest GetWorkerRequest(HttpContext context) 66 | { 67 | IServiceProvider serviceProvider = context; 68 | var workerRequest = (HttpWorkerRequest) serviceProvider.GetService(typeof (HttpWorkerRequest)); 69 | 70 | return workerRequest; 71 | } 72 | 73 | class EventType 74 | { 75 | public static readonly int SessionDataBegin = 42; 76 | public static readonly int SessionDataEnd = 43; 77 | } 78 | 79 | public class Keywords 80 | { 81 | public const EventKeywords AspNetReq = (EventKeywords) 1; 82 | } 83 | } 84 | } -------------------------------------------------------------------------------- /src/SessionStateModule/SessionOnEndTarget.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState 5 | { 6 | using System; 7 | using System.Web.SessionState; 8 | 9 | /* 10 | * Calls the OnSessionEnd event. We use an object other than the SessionStateModule 11 | * because the state of the module is unknown - it could have been disposed 12 | * when a session ends. 13 | */ 14 | 15 | class SessionOnEndTarget 16 | { 17 | private int _sessionEndEventHandlerCount; 18 | 19 | public int SessionEndEventHandlerCount 20 | { 21 | get { return _sessionEndEventHandlerCount; } 22 | set { _sessionEndEventHandlerCount = value; } 23 | } 24 | 25 | public void RaiseOnEnd(HttpSessionStateContainer sessionStateContainer) 26 | { 27 | if (_sessionEndEventHandlerCount > 0) 28 | { 29 | SessionStateUtility.RaiseSessionEnd(sessionStateContainer, this, EventArgs.Empty); 30 | } 31 | } 32 | 33 | public void RaiseSessionOnEnd(string id, SessionStateStoreData item) 34 | { 35 | var sessionStateContainer = new HttpSessionStateContainer( 36 | id, 37 | item.Items, 38 | item.StaticObjects, 39 | item.Timeout, 40 | false, 41 | SessionStateModuleAsync.ConfigCookieless, 42 | SessionStateModuleAsync.ConfigMode, 43 | true); 44 | 45 | RaiseOnEnd(sessionStateContainer); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/SessionStateModule/TaskAsyncHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState 5 | { 6 | using System; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using System.Web; 10 | 11 | static class TaskAsyncHelper 12 | { 13 | private static readonly Task CompletedTask = Task.FromResult(null); 14 | 15 | public static IAsyncResult BeginTask(HttpApplication app, Func taskFunc, AsyncCallback callback, object state) 16 | { 17 | Task task = taskFunc(app); 18 | if (task == null) 19 | { 20 | // Something went wrong - let our caller handle it. 21 | return null; 22 | } 23 | 24 | // We need to wrap the inner Task so that the IAsyncResult exposed by this method 25 | // has the state object that was provided as a parameter. We could be a bit smarter 26 | // about this to save an allocation if the state objects are equal, but that's a 27 | // micro-optimization. 28 | var resultToReturn = new TaskWrapperAsyncResult(task, state); 29 | 30 | // Task instances are always marked CompletedSynchronously = false, even if the 31 | // operation completed synchronously. We should detect this and modify the IAsyncResult 32 | // we pass back to our caller as appropriate. Only read the 'IsCompleted' property once 33 | // to avoid a race condition where the underlying Task completes during this method. 34 | bool actuallyCompletedSynchronously = task.IsCompleted; 35 | if (actuallyCompletedSynchronously) 36 | { 37 | resultToReturn.ForceCompletedSynchronously(); 38 | } 39 | 40 | if (callback != null) 41 | { 42 | // ContinueWith() is a bit slow: it captures execution context and hops threads. We should 43 | // avoid calling it and just invoke the callback directly if the underlying Task is 44 | // already completed. Only use ContinueWith as a fallback. There's technically a race here 45 | // in that the Task may have completed between the check above and the call to 46 | // ContinueWith below, but ContinueWith will do the right thing in both cases. 47 | if (actuallyCompletedSynchronously) 48 | { 49 | callback(resultToReturn); 50 | } 51 | else 52 | { 53 | task.ContinueWith(_ => callback(resultToReturn)); 54 | } 55 | } 56 | 57 | return resultToReturn; 58 | } 59 | 60 | // The parameter is named 'ar' since it matches the parameter name on the EndEventHandler delegate type, 61 | // and we expect that most consumers will end up invoking this method via an instance of that delegate. 62 | public static void EndTask(IAsyncResult ar) 63 | { 64 | if (ar == null) 65 | { 66 | throw new ArgumentNullException("ar"); 67 | } 68 | 69 | // Make sure the incoming parameter is actually the correct type. 70 | var taskWrapper = ar as TaskWrapperAsyncResult; 71 | if (taskWrapper == null) 72 | { 73 | // extraction failed 74 | throw new ArgumentException("ar"); 75 | } 76 | 77 | // The End* method doesn't actually perform any actual work, but we do need to maintain two invariants: 78 | // 1. Make sure the underlying Task actually *is* complete. 79 | // 2. If the Task encountered an exception, observe it here. 80 | // (TaskAwaiter.GetResult() handles both of those, and it rethrows the original exception rather than an AggregateException.) 81 | taskWrapper.Task.GetAwaiter().GetResult(); 82 | } 83 | 84 | public static void RunAsyncMethodSynchronously(Func func) 85 | { 86 | CompletedTask.ContinueWith(_ => func(), TaskScheduler.Default).Unwrap().Wait(); 87 | } 88 | } 89 | 90 | sealed class TaskWrapperAsyncResult : IAsyncResult 91 | { 92 | private bool _forceCompletedSynchronously; 93 | 94 | public TaskWrapperAsyncResult(Task task, object asyncState) 95 | { 96 | Task = task; 97 | AsyncState = asyncState; 98 | } 99 | 100 | public Task Task { get; } 101 | 102 | public object AsyncState { get; } 103 | 104 | public WaitHandle AsyncWaitHandle 105 | { 106 | get { return ((IAsyncResult) Task).AsyncWaitHandle; } 107 | } 108 | 109 | public bool CompletedSynchronously 110 | { 111 | get { return _forceCompletedSynchronously || ((IAsyncResult) Task).CompletedSynchronously; } 112 | } 113 | 114 | public bool IsCompleted 115 | { 116 | get { return ((IAsyncResult) Task).IsCompleted; } 117 | } 118 | 119 | public void ForceCompletedSynchronously() 120 | { 121 | _forceCompletedSynchronously = true; 122 | } 123 | } 124 | } -------------------------------------------------------------------------------- /src/SqlSessionStateProviderAsync/ISqlSessionStateRepository.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState 5 | { 6 | using System; 7 | using System.Threading.Tasks; 8 | using System.Web.SessionState; 9 | 10 | enum RepositoryType 11 | { 12 | SqlServer, 13 | InMemory, 14 | InMemoryDurable, 15 | FrameworkCompat 16 | } 17 | 18 | interface ISqlSessionStateRepository 19 | { 20 | void CreateSessionStateTable(); 21 | 22 | void DeleteExpiredSessions(); 23 | 24 | Task GetSessionStateItemAsync(string id, bool exclusive); 25 | 26 | Task CreateOrUpdateSessionStateItemAsync(bool newItem, string id, byte[] buf, int length, int timeout, int lockCookie, int orginalStreamLen); 27 | 28 | Task ResetSessionItemTimeoutAsync(string id); 29 | 30 | Task RemoveSessionItemAsync(string id, object lockId); 31 | 32 | Task ReleaseSessionItemAsync(string id, object lockId); 33 | 34 | Task CreateUninitializedSessionItemAsync(string id, int length, byte[] buf, int timeout); 35 | } 36 | 37 | class SessionItem 38 | { 39 | public SessionItem(byte[] item, bool locked, TimeSpan lockAge, object lockId, 40 | SessionStateActions actions) 41 | { 42 | Item = item; 43 | Locked = locked; 44 | LockAge = lockAge; 45 | LockId = lockId; 46 | Actions = actions; 47 | } 48 | 49 | public byte[] Item { get; private set; } 50 | 51 | public bool Locked { get; private set; } 52 | 53 | public TimeSpan LockAge { get; private set; } 54 | 55 | public object LockId { get; private set; } 56 | 57 | public SessionStateActions Actions { get; private set; } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/SqlSessionStateProviderAsync/Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {493B0482-572A-4465-BD52-4094351C2647} 9 | Library 10 | Properties 11 | Microsoft.AspNet.SessionState 12 | Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync 13 | v4.6.2 14 | 512 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | $(OutputPath)$(AssemblyName).xml 25 | ..\..\ 26 | true 27 | 28 | 29 | true 30 | full 31 | false 32 | DEBUG;TRACE 33 | prompt 34 | 4 35 | ..\obj\ 36 | 37 | 38 | portable 39 | true 40 | TRACE 41 | prompt 42 | 4 43 | ..\obj\ 44 | 45 | 46 | true 47 | 48 | 49 | $(RepositoryRoot)tools\35MSSharedLib1024.snk 50 | 51 | 52 | true 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | True 69 | True 70 | SR.resx 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | ResXFileCodeGenerator 85 | SR.Designer.cs 86 | 87 | 88 | 89 | 90 | {7238f90d-3bce-4f40-a5ba-ea36ad484bd6} 91 | Microsoft.AspNet.SessionState.SessionStateModule 92 | 93 | 94 | 95 | 96 | 5.1.6 97 | 98 | 99 | 100 | 101 | 102 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /src/SqlSessionStateProviderAsync/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices; 7 | 8 | // General Information about an assembly is controlled through the following 9 | // set of attributes. Change these attribute values to modify the information 10 | // associated with an assembly. 11 | [assembly: AssemblyTitle("Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync")] 12 | [assembly: AssemblyDescription("Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.dll")] 13 | [assembly: AssemblyConfiguration("")] 14 | [assembly: AssemblyCompany("Microsoft Corporation")] 15 | [assembly: AssemblyProduct("Microsoft AspNet Async SqlSessionStateProvider")] 16 | [assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | 20 | // Setting ComVisible to false makes the types in this assembly not visible 21 | // to COM components. If you need to access a type in this assembly from 22 | // COM, set the ComVisible attribute to true on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The following GUID is for the ID of the typelib if this project is exposed to COM 26 | [assembly: Guid("493b0482-572a-4465-bd52-4094351c2647")] 27 | 28 | [assembly: InternalsVisibleTo("Microsoft.AspNet.SessionState.SqlSessionStateAsyncProvider.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] 29 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] -------------------------------------------------------------------------------- /src/SqlSessionStateProviderAsync/Resources/SR.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Microsoft.AspNet.SessionState.Resources { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class SR { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal SR() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AspNet.SessionState.Resources.SR", typeof(SR).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Unable to connect to SQL Server session database.. 65 | /// 66 | internal static string Cant_connect_sql_session_database { 67 | get { 68 | return ResourceManager.GetString("Cant_connect_sql_session_database", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to The attribute 'connectionStringName' is missing or empty.. 74 | /// 75 | internal static string Connection_name_not_specified { 76 | get { 77 | return ResourceManager.GetString("Connection_name_not_specified", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to The connection name '{0}' was not found in the applications configuration or the connection string is empty.. 83 | /// 84 | internal static string Connection_string_not_found { 85 | get { 86 | return ResourceManager.GetString("Connection_string_not_found", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to The session state information is invalid and might be corrupted.. 92 | /// 93 | internal static string Invalid_session_state { 94 | get { 95 | return ResourceManager.GetString("Invalid_session_state", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to Failed to login to session state SQL server for user '{0}'.. 101 | /// 102 | internal static string Login_failed_sql_session_database { 103 | get { 104 | return ResourceManager.GetString("Login_failed_sql_session_database", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to Attribute not recognized '{0}'. 110 | /// 111 | internal static string Provider_unrecognized_attribute { 112 | get { 113 | return ResourceManager.GetString("Provider_unrecognized_attribute", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// Looks up a localized string similar to SessionId is too long.. 119 | /// 120 | internal static string Session_id_too_long { 121 | get { 122 | return ResourceManager.GetString("Session_id_too_long", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// Looks up a localized string similar to Session not found.. 128 | /// 129 | internal static string Session_not_found { 130 | get { 131 | return ResourceManager.GetString("Session_not_found", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// Looks up a localized string similar to The table '{0}' is compatible with a more recent repository type. Use the '{1}' repository type instead.. 137 | /// 138 | internal static string SessionTable_current { 139 | get { 140 | return ResourceManager.GetString("SessionTable_current", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// Looks up a localized string similar to The table '{0}' was not found in the database. The repositoryType '{1}' cannot create session state tables.. 146 | /// 147 | internal static string SessionTable_not_found { 148 | get { 149 | return ResourceManager.GetString("SessionTable_not_found", resourceCulture); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized string similar to Could not determine compatibility type for the table '{0}'.. 155 | /// 156 | internal static string SessionTable_unknown { 157 | get { 158 | return ResourceManager.GetString("SessionTable_unknown", resourceCulture); 159 | } 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /src/SqlSessionStateProviderAsync/Resources/SR.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Unable to connect to SQL Server session database. 122 | 123 | 124 | The attribute 'connectionStringName' is missing or empty. 125 | 126 | 127 | The connection name '{0}' was not found in the applications configuration or the connection string is empty. 128 | 129 | 130 | The session state information is invalid and might be corrupted. 131 | 132 | 133 | Failed to login to session state SQL server for user '{0}'. 134 | 135 | 136 | Attribute not recognized '{0}' 137 | 138 | 139 | The table '{0}' is compatible with a more recent repository type. Use the '{1}' repository type instead. 140 | 141 | 142 | The table '{0}' was not found in the database. The repositoryType '{1}' cannot create session state tables. 143 | 144 | 145 | Could not determine compatibility type for the table '{0}'. 146 | 147 | 148 | SessionId is too long. 149 | 150 | 151 | Session not found. 152 | 153 | -------------------------------------------------------------------------------- /src/SqlSessionStateProviderAsync/SqlCommandExtension.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState 5 | { 6 | using System.Diagnostics; 7 | using Microsoft.Data.SqlClient; 8 | 9 | static class SqlCommandExtension 10 | { 11 | public static SqlParameter GetOutPutParameterValue(this SqlCommand cmd, string parameterName) 12 | { 13 | // This is an internal method that only we call. We know 'parameterName' always begins 14 | // with an '@' so we don't need to check for that case. Be aware of that expectation. 15 | Debug.Assert(parameterName != null); 16 | Debug.Assert(parameterName[0] == '@'); 17 | return cmd.Parameters[parameterName]; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/SqlSessionStateProviderAsync/SqlCommandHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState 5 | { 6 | using Microsoft.Data.SqlClient; 7 | using System.Data; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | class SqlCommandHelper 12 | { 13 | private int _commandTimeout; 14 | 15 | public SqlCommandHelper(int commandTimeout) 16 | { 17 | this._commandTimeout = commandTimeout; 18 | } 19 | 20 | #region property for unit tests 21 | internal int CommandTimeout 22 | { 23 | get { return _commandTimeout; } 24 | } 25 | #endregion 26 | 27 | public SqlCommand CreateSqlCommand(string sql) 28 | { 29 | return CreateSqlCommandInternal(sql); 30 | } 31 | 32 | public SqlCommand CreateSqlCommandForSP(string spName) 33 | { 34 | return CreateSqlCommandForSPInternal(spName); 35 | } 36 | 37 | public async Task CreateSProcIfDoesNotExist(string sprocName, string createSProcSql, SqlConnection connection, SqlTransaction transaction) 38 | { 39 | string cmdText = $@"SELECT Count(*) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE' AND ROUTINE_NAME = '{sprocName}'"; 40 | var cmd = new SqlCommand(cmdText, connection, transaction); 41 | int count = (int)await cmd.ExecuteScalarAsync(); 42 | 43 | if (count == 0) 44 | { 45 | cmd = new SqlCommand(createSProcSql, connection, transaction); 46 | return await cmd.ExecuteNonQueryAsync(); 47 | } 48 | 49 | return 0; 50 | } 51 | 52 | private SqlCommand CreateSqlCommandInternal(string sql) 53 | { 54 | return new SqlCommand() 55 | { 56 | CommandType = CommandType.Text, 57 | CommandTimeout = _commandTimeout, 58 | CommandText = sql 59 | }; 60 | } 61 | 62 | private SqlCommand CreateSqlCommandForSPInternal(string spName) 63 | { 64 | return new SqlCommand() 65 | { 66 | CommandType = CommandType.StoredProcedure, 67 | CommandTimeout = _commandTimeout, 68 | CommandText = spName 69 | }; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/SqlSessionStateProviderAsync/SqlParameterCollectionExtension.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState 5 | { 6 | using Microsoft.Data.SqlClient; 7 | using System; 8 | using System.Data; 9 | 10 | static class SqlParameterCollectionExtension 11 | { 12 | public static SqlParameterCollection AddSessionIdParameter(this SqlParameterCollection pc, string id) 13 | { 14 | var param = new SqlParameter(SqlParameterName.SessionId, SqlDbType.NVarChar, SqlSessionStateRepositoryUtil.IdLength); 15 | param.Value = id; 16 | pc.Add(param); 17 | 18 | return pc; 19 | } 20 | 21 | public static SqlParameterCollection AddFxSessionIdParameter(this SqlParameterCollection pc, string id) 22 | { 23 | var param = new SqlParameter(SqlParameterName.FxSessionId, SqlDbType.NVarChar, SqlSessionStateRepositoryUtil.IdLength); 24 | param.Value = id; 25 | pc.Add(param); 26 | 27 | return pc; 28 | } 29 | 30 | public static SqlParameterCollection AddLockedParameter(this SqlParameterCollection pc) 31 | { 32 | var param = new SqlParameter(SqlParameterName.Locked, SqlDbType.Bit); 33 | param.Direction = ParameterDirection.Output; 34 | param.Value = Convert.DBNull; 35 | pc.Add(param); 36 | 37 | return pc; 38 | } 39 | 40 | public static SqlParameterCollection AddLockAgeParameter(this SqlParameterCollection pc) 41 | { 42 | var param = new SqlParameter(SqlParameterName.LockAge, SqlDbType.Int); 43 | param.Direction = ParameterDirection.Output; 44 | param.Value = Convert.DBNull; 45 | pc.Add(param); 46 | 47 | return pc; 48 | } 49 | 50 | public static SqlParameterCollection AddLockCookieParameter(this SqlParameterCollection pc, object lockId = null) 51 | { 52 | var param = new SqlParameter(SqlParameterName.LockCookie, SqlDbType.Int); 53 | if (lockId == null) 54 | { 55 | param.Direction = ParameterDirection.Output; 56 | param.Value = Convert.DBNull; 57 | } 58 | else 59 | { 60 | param.Value = lockId; 61 | } 62 | pc.Add(param); 63 | 64 | return pc; 65 | } 66 | 67 | public static SqlParameterCollection AddLockDateParameter(this SqlParameterCollection pc) 68 | { 69 | var param = new SqlParameter(SqlParameterName.LockDate, SqlDbType.DateTime); 70 | param.Direction = ParameterDirection.Output; 71 | param.Value = Convert.DBNull; 72 | pc.Add(param); 73 | 74 | return pc; 75 | } 76 | 77 | public static SqlParameterCollection AddActionFlagsParameter(this SqlParameterCollection pc) 78 | { 79 | var param = new SqlParameter(SqlParameterName.ActionFlags, SqlDbType.Int); 80 | param.Direction = ParameterDirection.Output; 81 | param.Value = Convert.DBNull; 82 | pc.Add(param); 83 | 84 | return pc; 85 | } 86 | 87 | public static SqlParameterCollection AddTimeoutParameter(this SqlParameterCollection pc, int timeout) 88 | { 89 | var param = new SqlParameter(SqlParameterName.Timeout, SqlDbType.Int); 90 | param.Value = timeout; 91 | pc.Add(param); 92 | 93 | return pc; 94 | } 95 | 96 | public static SqlParameterCollection AddSessionItemLongImageParameter(this SqlParameterCollection pc, int length, byte[] buf) 97 | { 98 | var param = new SqlParameter(SqlParameterName.SessionItemLong, SqlDbType.Image, length); 99 | param.Value = buf; 100 | pc.Add(param); 101 | 102 | return pc; 103 | } 104 | 105 | public static SqlParameterCollection AddSessionItemLongVarBinaryParameter(this SqlParameterCollection pc, int length, byte[] buf) 106 | { 107 | SqlParameter param = new SqlParameter(SqlParameterName.SessionItemLong, SqlDbType.VarBinary, length); 108 | param.Value = buf; 109 | pc.Add(param); 110 | 111 | return pc; 112 | } 113 | 114 | public static SqlParameterCollection AddItemLongParameter(this SqlParameterCollection pc, int length, byte[] buf) 115 | { 116 | var param = new SqlParameter(SqlParameterName.ItemLong, SqlDbType.Image, length); 117 | param.Value = buf; 118 | pc.Add(param); 119 | 120 | return pc; 121 | } 122 | 123 | public static SqlParameterCollection AddItemShortParameter(this SqlParameterCollection pc, int length = 0, byte[] buf = null) 124 | { 125 | SqlParameter param; 126 | 127 | if (buf == null) 128 | { 129 | param = new SqlParameter(SqlParameterName.ItemShort, SqlDbType.VarBinary, SqlSessionStateRepositoryUtil.ITEM_SHORT_LENGTH); 130 | param.Direction = ParameterDirection.Output; 131 | param.Value = Convert.DBNull; 132 | } 133 | else 134 | { 135 | param = new SqlParameter(SqlParameterName.ItemShort, SqlDbType.VarBinary, length); 136 | param.Value = buf; 137 | } 138 | pc.Add(param); 139 | 140 | return pc; 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /src/SqlSessionStateProviderAsync/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.AspNet.SessionState 2 | { 3 | internal static class StringExtensions 4 | { 5 | //============================================================================ robs == 6 | // This is to replace the call to GetHashCode() when appending AppId to the session id. 7 | // Using GetHashCode() is not deterministic and can cause problems when used externally (e.g in SQL) 8 | // Credit: https://andrewlock.net/why-is-string-gethashcode-different-each-time-i-run-my-program-in-net-core/ 9 | //====================================================================== 2023-07-21 == 10 | internal static int GetDeterministicHashCode(this string str) 11 | { 12 | unchecked 13 | { 14 | int hash1 = (5381 << 16) + 5381; 15 | int hash2 = hash1; 16 | 17 | for (int i = 0; i < str.Length; i += 2) 18 | { 19 | hash1 = ((hash1 << 5) + hash1) ^ str[i]; 20 | if (i == str.Length - 1) 21 | break; 22 | hash2 = ((hash2 << 5) + hash2) ^ str[i + 1]; 23 | } 24 | 25 | return hash1 + (hash2 * 1566083941); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/packages/CosmosDBSessionStateProviderAsync.nupkg/Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.nuproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildProjectName) 6 | $(MSBuildProjectName) 7 | Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.nuspec 8 | 9 | 10 | 11 | $(AssemblyPath) 12 | lib\Net462 13 | 14 | 15 | $(OutputPath) 16 | lib\Net462 17 | 18 | 19 | $(OutputPath) 20 | lib\Net462 21 | 22 | 23 | 24 | content\Net462 25 | 26 | 27 | docs\Readme.md 28 | 29 | 30 | images\dotnet-icon.png 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/packages/CosmosDBSessionStateProviderAsync.nupkg/Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $NuGetPackageId$ 5 | $NuGetPackageVersion$ 6 | Microsoft 7 | Microsoft 8 | © Microsoft Corporation. All rights reserved. 9 | Microsoft ASP.NET Async CosmosDBSessionStateProvider Provider 10 | In .Net 4.6.2, asp.net enables developer plug in async version of SessionState module which is a good fit for the non-in-memory SessionState data store. This SessionState provider uses CosmosDB as the data store and leverages async database operation to provide better scability. 11 | Async version CosmosDBSessionState provider 12 | en-US 13 | https://github.com/aspnet/AspNetSessionState 14 | images\dotnet-icon.png 15 | https://licenses.nuget.org/MIT 16 | MIT 17 | true 18 | docs\Readme.md 19 | ASP.NET Async SessionState Provider 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/packages/CosmosDBSessionStateProviderAsync.nupkg/content/Net462/web.config.install.xdt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 36 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/packages/CosmosDBSessionStateProviderAsync.nupkg/content/Net462/web.config.uninstall.xdt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/packages/Packages.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Release 6 | AnyCPU 7 | true 8 | 8.0.30703 9 | 2.0 10 | {7EC5863F-7FF1-41C7-A384-8FFF81531E7A} 11 | SAK 12 | SAK 13 | SAK 14 | SAK 15 | v4.8 16 | 17 | 18 | 19 | false 20 | false 21 | 22 | 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/packages/SessionStateModule.nupkg/Microsoft.AspNet.SessionState.SessionStateModule.nuproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildProjectName) 6 | $(MSBuildProjectName) 7 | Microsoft.AspNet.SessionState.SessionStateModule.nuspec 8 | 9 | 10 | 11 | $(AssemblyPath) 12 | lib\Net462 13 | 14 | 15 | $(OutputPath) 16 | lib\Net462 17 | 18 | 19 | $(OutputPath) 20 | lib\Net462 21 | 22 | 23 | 24 | content\Net462 25 | 26 | 27 | docs\Readme.md 28 | 29 | 30 | images\dotnet-icon.png 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/packages/SessionStateModule.nupkg/Microsoft.AspNet.SessionState.SessionStateModule.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $NuGetPackageId$ 5 | $NuGetPackageVersion$ 6 | Microsoft 7 | Microsoft 8 | © Microsoft Corporation. All rights reserved. 9 | Microsoft ASP.NET SessionState Module 10 | In .Net 4.6.2, asp.net enables plugin async SessionState module which is a good fit for the non-in-memory SessionState data store. This async SessionState module provides the extensibility to plugin an async version of SessionState provider. 11 | A SessionState module provides ability to plug in async SessionState provider. 12 | en-US 13 | https://github.com/aspnet/AspNetSessionState 14 | images\dotnet-icon.png 15 | https://licenses.nuget.org/MIT 16 | MIT 17 | true 18 | docs\Readme.md 19 | ASP.NET Async SessionState Module 20 | 21 | -------------------------------------------------------------------------------- /src/packages/SessionStateModule.nupkg/content/Net462/web.config.install.xdt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/packages/SessionStateModule.nupkg/content/Net462/web.config.uninstall.xdt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/packages/SqlSessionStateProviderAsync.nupkg/Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.nuproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildProjectName) 6 | $(MSBuildProjectName) 7 | Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.nuspec 8 | 9 | 10 | 11 | $(AssemblyPath) 12 | lib\Net462 13 | 14 | 15 | $(OutputPath) 16 | lib\Net462 17 | 18 | 19 | $(OutputPath) 20 | lib\Net462 21 | 22 | 23 | 24 | content\Net462 25 | 26 | 27 | docs\Readme.md 28 | 29 | 30 | images\dotnet-icon.png 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/packages/SqlSessionStateProviderAsync.nupkg/Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $NuGetPackageId$ 5 | $NuGetPackageVersion$ 6 | Microsoft 7 | Microsoft 8 | © Microsoft Corporation. All rights reserved. 9 | Microsoft ASP.NET Async SqlSessionState Provider 10 | In .Net 4.6.2, asp.net enables developer plug in async version of SessionState module which is a good fit for the non-in-memory SessionState data store. This SessionState provider uses SQL Server as the data store and leverages async database operation to provide better scability. 11 | Async version SqlSessionState provider 12 | en-US 13 | https://github.com/aspnet/AspNetSessionState 14 | images\dotnet-icon.png 15 | https://licenses.nuget.org/MIT 16 | MIT 17 | true 18 | docs\Readme.md 19 | ASP.NET Async SessionState Provider 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/packages/SqlSessionStateProviderAsync.nupkg/content/Net462/web.config.install.xdt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 21 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/packages/SqlSessionStateProviderAsync.nupkg/content/Net462/web.config.uninstall.xdt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/packages/assets/dotnet-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/AspNetSessionState/97428df0dbe5aac2e93f394cf08afffb45382c4a/src/packages/assets/dotnet-icon.png -------------------------------------------------------------------------------- /test/Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test/35MSSharedLib1024.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/AspNetSessionState/97428df0dbe5aac2e93f394cf08afffb45382c4a/test/Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test/35MSSharedLib1024.snk -------------------------------------------------------------------------------- /test/Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test/Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {2AF89ACA-3545-432D-8D99-C5230E8643A8} 9 | Library 10 | Properties 11 | Microsoft.AspNet.SessionState.CosmosDBSessionStateAsyncProvider.Test 12 | Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test 13 | v4.6.2 14 | 512 15 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 16 | 15.0 17 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 18 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 19 | False 20 | UnitTest 21 | ..\ 22 | true 23 | 24 | 25 | 26 | 27 | true 28 | full 29 | false 30 | bin\Debug\ 31 | DEBUG;TRACE 32 | prompt 33 | 4 34 | 35 | 36 | pdbonly 37 | true 38 | bin\Release\ 39 | TRACE 40 | prompt 41 | 4 42 | 43 | 44 | true 45 | 46 | 47 | $(RepositoryRoot)tools\35MSSharedLib1024.snk 48 | 49 | 50 | true 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | {4cfb2896-d5c1-4e96-a3da-d57c58539209} 82 | Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync 83 | 84 | 85 | {7238f90d-3bce-4f40-a5ba-ea36ad484bd6} 86 | Microsoft.AspNet.SessionState.SessionStateModule 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 4.2.1 95 | 96 | 97 | 4.7.137 98 | 99 | 100 | 8.0.5 101 | 102 | 103 | 2.4.2 104 | 105 | 106 | 2.4.2 107 | runtime; build; native; contentfiles; analyzers; buildtransitive 108 | all 109 | 110 | 111 | 2.4.2 112 | runtime; build; native; contentfiles; analyzers; buildtransitive 113 | all 114 | 115 | 116 | 2.4.5 117 | runtime; build; native; contentfiles; analyzers; buildtransitive 118 | all 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /test/Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices; 7 | 8 | // General Information about an assembly is controlled through the following 9 | // set of attributes. Change these attribute values to modify the information 10 | // associated with an assembly. 11 | [assembly: AssemblyTitle("Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test")] 12 | [assembly: AssemblyDescription("")] 13 | [assembly: AssemblyConfiguration("")] 14 | [assembly: AssemblyCompany("")] 15 | [assembly: AssemblyProduct("Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test")] 16 | [assembly: AssemblyCopyright("Copyright © 2018")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | 20 | // Setting ComVisible to false makes the types in this assembly not visible 21 | // to COM components. If you need to access a type in this assembly from 22 | // COM, set the ComVisible attribute to true on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The following GUID is for the ID of the typelib if this project is exposed to COM 26 | [assembly: Guid("2af89aca-3545-432d-8d99-c5230e8643a8")] 27 | -------------------------------------------------------------------------------- /test/Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.Test/SessionStateItemTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | namespace Microsoft.AspNet.SessionState.CosmosDBSessionStateAsyncProvider.Test 5 | { 6 | using System.Text.Json; 7 | using System.Text.Json.Serialization; 8 | using System; 9 | using System.Web.SessionState; 10 | using Xunit; 11 | 12 | public class SessionStateItemTest 13 | { 14 | private const string TestSessionId = "piqhlifa30ooedcp1k42mtef"; 15 | private const string JsonTemplate = "{{\"id\":\"{0}\",\"lockAge\":{1},\"lockCookie\":{2},\"ttl\":{3},\"locked\":{4},\"sessionItem\":\"{5}\",\"uninitialized\":{6}}}"; 16 | 17 | [Fact] 18 | public void SessionStateItem_Can_Be_Serialized_With_Null_LockAge() 19 | { 20 | var item = new SessionStateItem() 21 | { 22 | Actions = SessionStateActions.None, 23 | LockAge = null, 24 | LockCookie = 1, 25 | Locked = false, 26 | SessionId = TestSessionId, 27 | SessionItem = new byte[2] { 1, 1 }, 28 | Timeout = 10 29 | }; 30 | var json = JsonSerializer.Serialize(item); 31 | var expected = string.Format(JsonTemplate, item.SessionId, "null", item.LockCookie, item.Timeout, item.Locked, "AQE=", false); 32 | 33 | Assert.Equal(expected, json, true); 34 | } 35 | 36 | [Fact] 37 | public void SessionStateItem_Can_Be_Serialized_With_LockAge() 38 | { 39 | var item = new SessionStateItem() 40 | { 41 | Actions = SessionStateActions.InitializeItem, 42 | LockAge = TimeSpan.FromMinutes(1), 43 | LockCookie = 1, 44 | Locked = true, 45 | SessionId = TestSessionId, 46 | SessionItem = new byte[2] { 1, 1 }, 47 | Timeout = 10 48 | }; 49 | var json = JsonSerializer.Serialize(item); 50 | var expected = string.Format(JsonTemplate, item.SessionId, 60 * 1, item.LockCookie, item.Timeout, item.Locked, "AQE=", true); 51 | 52 | Assert.Equal(expected, json, true); 53 | } 54 | 55 | [Fact] 56 | public void SessionStateItem_Can_Be_Deserialized_With_Null_Uninitialized() 57 | { 58 | var json = string.Format(JsonTemplate, TestSessionId, 60, 1, 20, "false", "AQE=", "null"); 59 | 60 | var item = JsonSerializer.Deserialize(json); 61 | 62 | Assert.Equal(TestSessionId, item.SessionId); 63 | Assert.False(item.Actions.HasValue); 64 | Assert.Equal(1, item.LockCookie); 65 | Assert.Equal(new byte[2] { 1, 1 }, item.SessionItem); 66 | Assert.False(item.Locked); 67 | Assert.Equal(20, item.Timeout); 68 | Assert.Equal(TimeSpan.FromSeconds(60), item.LockAge); 69 | } 70 | 71 | [Fact] 72 | public void SessionStateItem_Can_Be_Deserialized_With_True_Uninitialized() 73 | { 74 | var json = string.Format(JsonTemplate, TestSessionId, 60, 1, 20, "false", "AQE=", "true"); 75 | 76 | var item = JsonSerializer.Deserialize(json); 77 | 78 | Assert.Equal(TestSessionId, item.SessionId); 79 | Assert.Equal(SessionStateActions.InitializeItem, item.Actions); 80 | Assert.Equal(1, item.LockCookie); 81 | Assert.Equal(new byte[2] { 1, 1 }, item.SessionItem); 82 | Assert.False(item.Locked); 83 | Assert.Equal(20, item.Timeout); 84 | Assert.Equal(TimeSpan.FromSeconds(60), item.LockAge); 85 | } 86 | 87 | [Fact] 88 | public void SessionStateItem_Can_Be_Deserialized_With_False_Uninitialized_And_Null_Lockage() 89 | { 90 | var json = string.Format(JsonTemplate, TestSessionId, "null", 1, 10, "true", "AQE=", "false"); 91 | 92 | var item = JsonSerializer.Deserialize(json); 93 | 94 | Assert.Equal(TestSessionId, item.SessionId); 95 | Assert.Equal(SessionStateActions.None, item.Actions); 96 | Assert.Equal(1, item.LockCookie); 97 | Assert.Equal(new byte[2] { 1, 1 }, item.SessionItem); 98 | Assert.True(item.Locked); 99 | Assert.Equal(10, item.Timeout); 100 | Assert.False(item.LockAge.HasValue); 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /test/Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test/Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {AD91AAF5-3B57-4C8C-9A39-92FB578AF317} 9 | Library 10 | Properties 11 | Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test 12 | Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test 13 | v4.6.2 14 | 512 15 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 16 | 15.0 17 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 18 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 19 | False 20 | UnitTest 21 | ..\ 22 | true 23 | 24 | 25 | ;INCLUDE_ADVANCED_TESTS 26 | 27 | 28 | true 29 | full 30 | false 31 | bin\Debug\ 32 | TRACE;DEBUG;BUILD_GENERATED_VERSION$(IncludeAdvancedTests) 33 | prompt 34 | 4 35 | 36 | 37 | pdbonly 38 | true 39 | bin\Release\ 40 | TRACE;BUILD_GENERATED_VERSION$(IncludeAdvancedTests) 41 | prompt 42 | 4 43 | 44 | 45 | true 46 | 47 | 48 | $(RepositoryRoot)tools\35MSSharedLib1024.snk 49 | 50 | 51 | true 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | {7238f90d-3bce-4f40-a5ba-ea36ad484bd6} 72 | Microsoft.AspNet.SessionState.SessionStateModule 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 4.2.1 81 | 82 | 83 | 4.7.137 84 | 85 | 86 | 2.4.2 87 | 88 | 89 | 2.4.2 90 | runtime; build; native; contentfiles; analyzers; buildtransitive 91 | all 92 | 93 | 94 | 2.4.2 95 | runtime; build; native; contentfiles; analyzers; buildtransitive 96 | all 97 | 98 | 99 | 2.4.5 100 | runtime; build; native; contentfiles; analyzers; buildtransitive 101 | all 102 | 103 | 104 | 1.4.13 105 | 106 | 107 | 108 | 109 | 110 | 111 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 112 | 113 | 114 | 115 | 122 | -------------------------------------------------------------------------------- /test/Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices; 7 | 8 | // General Information about an assembly is controlled through the following 9 | // set of attributes. Change these attribute values to modify the information 10 | // associated with an assembly. 11 | [assembly: AssemblyTitle("Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test")] 12 | [assembly: AssemblyDescription("")] 13 | [assembly: AssemblyConfiguration("")] 14 | [assembly: AssemblyCompany("")] 15 | [assembly: AssemblyProduct("Microsoft.AspNet.SessionState.SessionStateModuleAsync.Test")] 16 | [assembly: AssemblyCopyright("Copyright © 2016")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | 20 | // Setting ComVisible to false makes the types in this assembly not visible 21 | // to COM components. If you need to access a type in this assembly from 22 | // COM, set the ComVisible attribute to true on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The following GUID is for the ID of the typelib if this project is exposed to COM 26 | [assembly: Guid("ad91aaf5-3b57-4c8c-9a39-92fb578af317")] 27 | -------------------------------------------------------------------------------- /test/Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test/Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2} 9 | Library 10 | Properties 11 | Microsoft.AspNet.SessionState.SqlSessionStateAsyncProvider.Test 12 | Microsoft.AspNet.SessionState.SqlSessionStateAsyncProvider.Test 13 | v4.6.2 14 | 512 15 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 16 | 15.0 17 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 18 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 19 | False 20 | UnitTest 21 | ..\ 22 | true 23 | 24 | ;INCLUDE_ADVANCED_TESTS 25 | 26 | 27 | true 28 | full 29 | false 30 | bin\Debug\ 31 | TRACE;DEBUG;BUILD_GENERATED_VERSION$(IncludeAdvancedTests) 32 | prompt 33 | 4 34 | 35 | 36 | pdbonly 37 | true 38 | bin\Release\ 39 | TRACE;BUILD_GENERATED_VERSION$(IncludeAdvancedTests) 40 | prompt 41 | 4 42 | 43 | 44 | true 45 | 46 | 47 | $(RepositoryRoot)tools\35MSSharedLib1024.snk 48 | 49 | 50 | true 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | {7238f90d-3bce-4f40-a5ba-ea36ad484bd6} 72 | Microsoft.AspNet.SessionState.SessionStateModule 73 | 74 | 75 | {493b0482-572a-4465-bd52-4094351c2647} 76 | Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 4.2.1 85 | 86 | 87 | 4.7.137 88 | 89 | 90 | 2.4.2 91 | 92 | 93 | 2.4.2 94 | runtime; build; native; contentfiles; analyzers; buildtransitive 95 | all 96 | 97 | 98 | 2.4.2 99 | runtime; build; native; contentfiles; analyzers; buildtransitive 100 | all 101 | 102 | 103 | 2.4.5 104 | runtime; build; native; contentfiles; analyzers; buildtransitive 105 | all 106 | 107 | 108 | 1.4.13 109 | 110 | 111 | 112 | 113 | 114 | 115 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 116 | 117 | 118 | 119 | 126 | -------------------------------------------------------------------------------- /test/Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. See the License.txt file in the project root for full license information. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices; 7 | 8 | // General Information about an assembly is controlled through the following 9 | // set of attributes. Change these attribute values to modify the information 10 | // associated with an assembly. 11 | [assembly: AssemblyTitle("test")] 12 | [assembly: AssemblyDescription("")] 13 | [assembly: AssemblyConfiguration("")] 14 | [assembly: AssemblyCompany("")] 15 | [assembly: AssemblyProduct("test")] 16 | [assembly: AssemblyCopyright("Copyright © 2016")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | 20 | // Setting ComVisible to false makes the types in this assembly not visible 21 | // to COM components. If you need to access a type in this assembly from 22 | // COM, set the ComVisible attribute to true on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The following GUID is for the ID of the typelib if this project is exposed to COM 26 | [assembly: Guid("cbb00b6c-8a44-43f0-be73-0b0e8565f8a2")] 27 | -------------------------------------------------------------------------------- /tools/.verif.whitelist: -------------------------------------------------------------------------------- 1 | *\lib\*\*.xml,ignore xmldoc files -------------------------------------------------------------------------------- /tools/35MSSharedLib1024.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/AspNetSessionState/97428df0dbe5aac2e93f394cf08afffb45382c4a/tools/35MSSharedLib1024.snk -------------------------------------------------------------------------------- /tools/CosmosDBSessionStateProviderAsync.settings.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 2 7 | 1 8 | 0 9 | 10 | 11 | 12 | 2.1.0-preview1 13 | 3.46.1 14 | 8.0.5 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tools/MicrosoftAspNetSessionState.settings.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildThisFileDirectory)version.targets;$(MSBuildThisFileDirectory)signing.targets 5 | $(MSBuildThisFileDirectory)signing.targets 6 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Aspnet.SessionState.sln))\ 7 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Aspnet.SessionState.sln))\ 8 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 28 | preview1 29 | 2025 30 | 31 | 32 | 33 | 34 | 35 | Release 36 | $(RepositoryRoot).binaries\bin\$(Configuration)\ 37 | $(RepositoryRoot).binaries\obj\$(Configuration)\$(MSBuildProjectName)\ 38 | $(CodeSignOutputPath) 39 | $(OutputPath) 40 | $(OutputPath)test\ 41 | 42 | 43 | 44 | $(RepositoryRoot).binaries\Packages\$(Configuration) 45 | 46 | true 47 | $(RepositoryRoot)packages\ 48 | $(RepositoryRoot)\src\$(MSBuildProjectName)\ 49 | $(MSBuildProjectDirectory)\tools\Net471 50 | $(MSBuildProjectDirectory)\shared\tools\Net471 51 | pp 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | $(RepositoryRoot)\test\Microsoft.AspNet.SessionState.AsyncProviders.SqlSessionStateProviderAsync.Test 61 | true 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | NuGetPackageVersion=$(NuGetPackageVersion); 70 | NuGetPackageId=$(NuGetPackageId); 71 | SessionStateModuleNuGetPackageVersion=$(SessionStateModuleNuGetPackageVersion); 72 | MicrosoftDataSqlClientPackageVersion=$(MicrosoftDataSqlClientPackageVersion); 73 | CosmosNuGetPackageVersion=$(CosmosNuGetPackageVersion); 74 | SystemTextJsonPackageVersion=$(SystemTextJsonPackageVersion) 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /tools/NuGet.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\..\ 5 | 6 | 7 | false 8 | 9 | 10 | false 11 | 12 | 13 | true 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) 31 | 32 | 33 | 34 | 35 | $(SolutionDir).nuget 36 | 37 | 38 | 39 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config 40 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config 41 | 42 | 43 | 44 | $(MSBuildProjectDirectory)\packages.config 45 | $(PackagesProjectConfig) 46 | 47 | 48 | 49 | 50 | $(NuGetToolsPath)\NuGet.exe 51 | @(PackageSource) 52 | 53 | "$(NuGetExePath)" 54 | mono --runtime=v4.0.30319 $(NuGetExePath) 55 | 56 | $(TargetDir.Trim('\\')) 57 | 58 | -RequireConsent 59 | -NonInteractive 60 | 61 | "$(SolutionDir)" 62 | "$(SolutionDir)" 63 | 64 | 65 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) 66 | $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols 67 | 68 | 69 | 70 | RestorePackages; 71 | $(BuildDependsOn); 72 | 73 | 74 | 75 | 76 | $(BuildDependsOn); 77 | BuildPackage; 78 | 79 | 80 | 81 | 82 | 83 | 84 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 99 | 100 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /tools/NuProj.Tasks.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/AspNetSessionState/97428df0dbe5aac2e93f394cf08afffb45382c4a/tools/NuProj.Tasks.dll -------------------------------------------------------------------------------- /tools/SessionStateModule.settings.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 2 7 | 1 8 | 0 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tools/SqlSessionStateProviderAsync.settings.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 2 7 | 1 8 | 0 9 | 10 | 11 | 12 | 2.1.0-preview1 13 | 5.1.6 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tools/signing.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Microsoft400 8 | MsSharedLib72 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Microsoft400 18 | 19 | 20 | Microsoft400 21 | 22 | 23 | 25 | 27 | 28 | 29 | 30 | 31 | $(PackageOutputDir) 32 | 33 | 34 | 35 | NuGet 36 | 37 | 38 | 39 | 40 | --------------------------------------------------------------------------------