HttpContext.Current should not be read-only
afshinm opened this issue ยท 4 comments
Describe the bug
Looking at the System.Web
implementation, it seems like HttpContext.Current
is not read-only https://github.com/microsoft/referencesource/blob/master/System.Web/HttpContext.cs#L566-L579 which is different than our implementation https://github.com/dotnet/systemweb-adapters/blob/main/src/Microsoft.AspNetCore.SystemWebAdapters/HttpContext.cs#L31
To Reproduce
Try HttpContext.Current = new HttpContext(...);
and you will get this error "CS0200: Property or indexer 'HttpContext.Current' cannot be assigned to -- it is read only"
Exceptions (if any)
None, causes build error.
Further technical details
Please include the following if applicable:
ASP.NET Framework Application:
- Technologies and versions used (i.e. MVC/WebForms/etc):
- .NET Framework Version: 4.7.2
- IIS Version: 10
- Windows Version: 11
ASP.NET Core Application:
- Targeted .NET version: 6.0
- .NET SDK version: 1.2.0
That's fine - feel free to make a PR
@afshinm are you interested in providing this? we'll be releasing a v1.3 around the time of .net 8 release
@twsouthwick yeah sure, I should be able to send a PR tomorrow.
@twsouthwick Sorry for the delay, I just opened a PR to address this issue #416