Hi All,
How to call Session variables in another project in the Same Solution MVC application
I want validate the session in in another project within the same solution like,
I Have tried below reference, but i cant get exact output details
If have proper solution pls post here.


Jayraj ChhayaRank #304 · 8.2K reputationPosted Dec 11, 2023, 7:46 AM EST
To call the Session validate and Session variables in another project within the same solution in an MVC application, you need to follow these steps:
Add a reference to the project where you want to access the Session variables. Right-click on the project in the Solution Explorer, select "Add" and then "Reference". Choose the project that contains the Session variables and click "OK".
Import the namespace of the project that contains the Session variables in the file where you want to access them. You can do this by adding the following line at the top of your file:
using YourProjectNamespace;Replace
YourProjectNamespacewith the actual namespace of the project that contains the Session variables.HttpContext.Current.Sessionproperty. This property provides access to the current Session object. For example, you can check if a Session variable exists and has a value like this:if (HttpContext.Current.Session["YourSessionVariable"] != null) { // Session variable exists and has a value } else { // Session variable does not exist or has no value }Replace
"YourSessionVariable"with the name of your Session variable.HttpContext.Current.Sessionproperty as well. For example, to get the value of a Session variable, you can use the following code:var sessionValue = HttpContext.Current.Session["YourSessionVariable"];Replace
"YourSessionVariable"with the name of your Session variable.By following these steps, you should be able to call the Session validate and Session variables in another project within the same solution in your MVC application. Make sure to add the necessary references and import the correct namespaces to access the Session variables successfully.
Venkat GovindRank #2,911 · 494 reputationPosted Apr 3, 2024, 12:59 AM EDT
Hi Jayaraj,
thanks for your reply, Inside solution one project is MVC projects and another one is core Project, in this scenrio its not working , another slution for this ,
Thanks a lot your posting answer