Solved

Custom SharePoint Site with AAM URL giving Session error.

Posted on 2013-05-10
5
776 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

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…
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 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