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.

Venkat GovindPosted Apr 3, 2024, 4:59 AM
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
Jayraj ChhayaPosted Dec 11, 2023, 12:46 PM
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:
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: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: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.