Solved

Custom SharePoint Site with AAM URL giving Session error.

Posted on 2013-05-10
5
765 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
tx
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

A question that is asked often, is how to generate sequential numbers in InfoPath Forms. The best way to achieve this is to use a SQL database, along with a stored procedure and a web service to connect Forms Services to the DB. The first thing t…
The vision: A MegaMenu for a SharePoint portal home page The mission: Make it easy to maintain. Allow rich content and sub headers as well as standard links. Factor in frequent changes without involving developers or a lengthy Dev/Test/Prod rel…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now