HttpContext.Current.Session is null when routing requests
Got it. Quite stupid, actually. It worked after I removed & added the SessionStateModule like so:
<configuration>
...
<system.webServer>
...
<modules>
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
...
</modules>
</system.webServer>
</configuration>
Simply adding it won't work since "Session" should have already been defined in the machine.config
.
Now, I wonder if that is the usual thing to do. It surely doesn't seem so since it seems so crude...
Session values returning null
Found the issue... and feel like an idiot. Even though I went and closed all the instances in IIS Express and my running Services, there was another instance of the project being ran somewhere, thus confusing my session items.
To make sure I had everything up to date, I went in and modified the port number
(Right click Project -> Properties)
After doing so, everything worked as expected. This might be a very unique case, but wanted to post just in case someone might run into a similar situation.
HttpContext.Current.Session is null while calling async webservices
I ended up with the decision to refactor the whole project.
HttpContext.Current.Session is null requesting images. Why?
Why would you need a session for retrieving a static file?
Unless you are using a dynamic handler, there is absolutely no need for session to retrieve such content.
My point is that session does not serve any useful purpose for retrieving static content, so it is not available.
Related Topics
Routing: the Current Request for Action [...] Is Ambiguous Between the Following Action Methods
Built in .Net Algorithm to Round Value to the Nearest 10 Interval
C# "Internal" Access Modifier When Doing Unit Testing
What Are the Benefits of Using C# VS F# or F# VS C#
How to Seed in Entity Framework Core 2
Getting/Setting File Owner in C#
How Is Performance Affected by an Unused Using Directive
Understanding .Asenumerable() in Linq to SQL
Authorization Header Is Lost on Redirect
How to Ensure a Form Displays on the "Additional" Monitor in a Dual Monitor Scenario
How to Disable a Tab Inside a Tabcontrol
How to Unload an Assembly from the Primary Appdomain
Mysqlcommand Command.Parameters.Add Is Obsolete
How to Select Text from the Richtextbox and Then Color It
How Best to Read a File into List<String>
Are There Any Reasons to Use Private Properties in C#
What's the How to Minimize to Tray a C# Winforms App
How to Obfuscate My C# Code, So It Can't Be Deobfuscated So Easily