Solved

Custom SharePoint Site with AAM URL giving Session error.

Posted on 2013-05-10
5
777 Views
Last Modified: 2013-06-25
Hi, I have customized the SharePoint 2010 site and using c# code for session state code like:
Session ["test"].
That site is working fine with above code when using default SharePoint URL i.e. http://myworld:2456
But when using Intranet url i.e. http://travel.space.com then it’s giving error where using session:
Error:
“Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.”
-----------------------------------------------------
For Intranet url I have just made an entry in DNS http://travel.space.com with SharePoint server IP and in SharePoint Central Administration site in alternate access mapping made and entry for Intranet zone with http://travel.space.com. Site is opening successfully but that session code using for some action is not working.
Kindly guide.
0
Comment
Question by:Minesh Shah
5 Comments
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39155810
Hi,
it seems that you have a second web app connected to the same content database.
Please go to central admin and verify in "Manage web application" page, that you have not the two web apps from above.
0
 
LVL 5

Expert Comment

by:manojce
ID: 39160502
Hi,

As per given error you have to enable session state from your web config's page tage as per below.

Go to your sites' web.config file & open.
Then search for "<pages".
Now see then property "enablesessionstate" is true OR not.
If not then add this property to true. as per below code.

<pages enablesessionstate="true">
    <httpmodules>
        <add type="System.Web.SessionState.SessionStateModule" name="Session" />
    </httpmodules>

Open in new window


Let me know if you have any query.

Thanks,
0
 
LVL 10

Author Comment

by:Minesh Shah
ID: 39183846
Dear RainerJ,
http://travel.space.com is not a web application it is just a URL which I entered as an entry in DNS and then made and entry in SharePoint Central Administration in Alternet Access Mapping against SharePoint web application default URL http://myworld:2456 .
Means with the help of Alternet Access Mapping I can access content of http://myworld:2456 also by http://travel.space.com 
So site is opening via both URL only problem is with the session code.

Dear manojce:
I had already tried the :
<pages enablesessionstate="true"> <httpmodules> <add type="System.Web.SessionState.SessionStateModule" name="Session" /> </httpmodules>

But no luck.

is there any entry needs to be done in IIS?
0
 
LVL 8

Accepted Solution

by:
vaderj earned 500 total points
ID: 39242587
You might try going a step further -
Remove the AAM to the external URL.
Extend the web application to your external URL.
Create a new AAM to your external URL under the Internet zone.
Make the neccesary modifications in the web.config for your extended URL (make sure you use the object model to make your web.config mods as sharepoint health analyzer can somtimes go back and revert web.config changes!)

My guess would be that your code is failing externally because it is referencing the internal URL when the internal URL isnt accessable from the outside - this should resolve that issue
0
 
LVL 10

Author Closing Comment

by:Minesh Shah
ID: 39275431
tx
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Last week I faced a strange issue recently, i have deployed SharePoint 2003 servers for one project and one of the requirements was to open SharePoint site from same server. when i was trying to open site from the same server i was getting authentic…
When installing SharePoint 2010 RTM I came across a strange error, I was getting timeouts during the installation. I searched the web and found the best solution to be found here (http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010genera…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question