Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a website with its admin site containing session. The session is made in Global.asax page and added to master page of admin site. It's running properly offline. But at server, when I log on to admin site and come at admin home page, no page is further opening. Any solution?
Is there any need to write something in Web.config file for session. I haven't written anything in web.config related to session.
Posted
Updated 11-Mar-14 23:35pm
v2
Comments
V5709 12-Mar-14 5:55am    
what is the purpose of using session in gobal.asax file?

1 solution

If I understand the question correctly, the problem may be related to cookie domain. While browsing locally, your domain for admin and other site is same i.e localhost and that is why the session is shared.
You will need to update your web.config to specify the parent domain to share the Session. But be careful that all your cookies and session will be shared between the two sites.
XML
<httpCookies domain=".parentDomain.com"/>


Let me know if that helps.
 
Share this answer
 
Comments
Member 10647302 13-Mar-14 5:17am    
Thanks for the answer. Your answer is quite nice. But I would like to mention one important point that I have made no session in my main website. There is only one session and only for admin. Would your code work for it.
And could you please tell me the entire code that I've to write for session in web.config file. I am a beginner.
Ankur\m/ 13-Mar-14 6:04am    
Yes, it would work. But as I said before, all sessions will be available to your admin website.
You just need to find httpCookies node in your web.config file and add domain in it as I mentioned in my answer. For more details, please Google 'httpCookies ASP.NET'.
Hope that helps!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900