Skip to content

Commit 2bf3836

Browse files
Only remove what we know is safe to remove. (#87)
1 parent bce548c commit 2bf3836

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

src/packages/CosmosDBSessionStateProviderAsync.nupkg/content/Net462/web.config.uninstall.xdt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,22 @@
55
<add key="cosmosDBAuthKeySetting" xdt:Transform="Remove" xdt:Locator="Match(key)" />
66
</appSettings>
77
<system.web>
8-
<sessionState cookieless="false" regenerateExpiredSessionId="true"
9-
mode="Custom" customProvider="CosmosDBSessionStateProviderAsync" xdt:Transform="Remove">
8+
<!-- We don't want to touch attributes in <sessionState> that might not apply to us. -->
9+
<!-- We also can't know what mode/provider to revert to when we uninstall ourselves, -->
10+
<!-- or if we were even the currently selected custom provider to use. -->
11+
<!-- Unfortunately, the best we can do is leave a broken state that requires obvious -->
12+
<!-- intervention. We could clear 'customProvider' if it matches our default-given -->
13+
<!-- name, but that isn't 100% accurate and doesn't really change the error anyway. -->
14+
<sessionState>
15+
1016
<providers>
11-
<add name="CosmosDBSessionStateProviderAsync"
17+
<add name="CosmosDBSessionStateProviderAsync"
1218
type="Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync, Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
1319
xdt:Transform="Remove" xdt:Locator="Match(type)" />
1420
</providers>
21+
22+
<providers xdt:Transform="RemoveAll" xdt:Locator="Condition(count(*)=0)" />
23+
1524
</sessionState>
1625
</system.web>
1726
</configuration>

src/packages/SessionStateModule.nupkg/content/Net462/web.config.uninstall.xdt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
<remove name="Session" xdt:Transform="Remove" xdt:Locator="Match(name)" />
77
<add name="Session"
88
type="Microsoft.AspNet.SessionState.SessionStateModuleAsync, Microsoft.AspNet.SessionState.SessionStateModule, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
9-
preCondition="integratedMode" xdt:Transform="Remove" xdt:Locator="Match(type)" />
9+
xdt:Transform="Remove" xdt:Locator="Match(type)" />
1010
</modules>
11+
12+
<modules xdt:Transform="RemoveAll" xdt:Locator="Condition(count(*)=0)" />
1113
</system.webServer>
14+
<system.webServer xdt:Transform="RemoveAll" xdt:Locator="Condition(count(*)=0)" />
1215
</configuration>
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
3-
43
<system.web>
5-
<sessionState cookieless="false" regenerateExpiredSessionId="true"
6-
mode="Custom" customProvider="SqlSessionStateAsyncProvider" xdt:Transform="Remove">
4+
<!-- We don't want to touch attributes in <sessionState> that might not apply to us. -->
5+
<!-- We also can't know what mode/provider to revert to when we uninstall ourselves, -->
6+
<!-- or if we were even the currently selected custom provider to use. -->
7+
<!-- Unfortunately, the best we can do is leave a broken state that requires obvious -->
8+
<!-- intervention. We could clear 'customProvider' if it matches our default-given -->
9+
<!-- name, but that isn't 100% accurate and doesn't really change the error anyway. -->
10+
<sessionState>
11+
712
<providers>
8-
<add name="SqlSessionStateAsyncProvider" connectionStringName="DefaultConnection"
13+
<add name="SqlSessionStateAsyncProvider"
914
type="Microsoft.AspNet.SessionState.SqlSessionStateAsyncProvider, Microsoft.AspNet.SessionState.SqlSessionStateAsyncProvider, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
1015
xdt:Transform="Remove" xdt:Locator="Match(type)" />
1116
</providers>
17+
18+
<providers xdt:Transform="RemoveAll" xdt:Locator="Condition(count(*)=0)" />
19+
1220
</sessionState>
1321
</system.web>
1422
</configuration>

0 commit comments

Comments
 (0)