Using CompleteSharepoint.Net on hostheader based site.

Sep 16, 2009 at 12:29 PM
Edited Sep 16, 2009 at 12:30 PM

Hi,

1. I have created a team site using host header. Let us call it http://www.mysite.com.

2. Then I created sub site using CompleteSharepoint.Net Publishing site definition.

3. Then, error occurs on new site.

When I debugged the code I found that error is while accessing session object.

namespace CompleteSharepoint.NET.Core.Global.ObjectPersistenceStorage

{

public class SessionObjectPersistenceStorage : IObjectPersistenceStorage

{.

.

.

public void SetInStorage(string key, object value)

{

HttpContext.Current.Session[key] = value;               /// Error is occuring here. Session=null. So not allowing to add new key.

}

.

.

I tried to find why session variables are not getting created when I am using host header, but couldnt find anything.

Let me know if you have any solution/ any suggestion.

Thanks in advance.

Coordinator
Sep 16, 2009 at 2:34 PM

Have you enabled session in web.config? Please refer to developers guide for it.

 

Cheers,

Tommy

Sep 17, 2009 at 4:03 AM

Thanks for fast reply again.

Yes. I did enable the session. The same configuration is working without any error if I dont create host header.

I am giving the snippet of my web.config.....

.

.

.

<httpModules>

      <clear />

      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

     

      <add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

      <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />

      <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />

      <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />

      <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />

      <add name="RoleManager" type="System.Web.Security.RoleManagerModule" />

      <add name="Session" type="System.Web.SessionState.SessionStateModule"/>

 

      <add name="PublishingPageUrlHandlerModule" type="CompleteSharepoint.NET.Web.PublishingPageUrlHandlerModule,CompleteSharepoint.NET.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9911d32a5d039082" />

    </httpModules>

.

.

.

.

<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7">

Coordinator
Sep 17, 2009 at 4:34 AM

Strange.

Have you set the correct web.config? That setting shouldn't have anything to do with whether you're using custom host header or not. I normally use custom host header and it works.

Each web application creates its own IIS home directory folder. Can you please ensure that you've edited the correct web.config?

Cheers,
Tommy

Sep 17, 2009 at 4:50 AM
Edited Sep 17, 2009 at 12:08 PM

Let me tell you the complete scenario.

I created normal site collection on web application http://milind-2k8:888/ with completesharepoint site template. I modified the web.config to make CS.NET work and it worked fine. There was no single issue on it.

Then, I extended same web application [that means it is using the same web.config] to create host header based site. Here is the command I used:

STSADM -o createsite -url http://www.mysite.com -owneremail [MYEMAILID] -ownerlogin [MYLOGINNAME] -sitetemplate STS#1 -title "MY SITE" -hhurl http://milind-2k8:888

This created a site collection http://www.mysite.com with team site template. There was no issue so far.

Now, I created subsite under http://www.mysite.com using CS.NET Publishing site template. It created the site but CS.NET code is throwing the exception at following line:

public void SetInStorage(string key, object value)

{

HttpContext.Current.Session[key] = value;               /// Error is occuring here. Session=null. So not allowing to add new key.

}

------------------------------------------------------------------------------------------------------------------------------

I am using Wndows 2k8 (64bit).

Coordinator
Sep 17, 2009 at 4:56 AM

Ah :)

You should create root site collection using CS.NET's Publishing template and not STS. You can use STS but then you have to activate the feature one-by-one and in the correct order.

That's why I supplied users with my web site project template so that they can just copy and change the parameters.

Cheers,
Tommy

Sep 17, 2009 at 5:01 AM

Ok. I missed to mention in previous reply:

After STSADM -o createsite .... was executed, I did activate all CS.NET the features on root site collection in correct order(I was aware of the interdependency of features there) before new site was created under it.

:)

Coordinator
Sep 17, 2009 at 5:48 AM

Wow....hmmm I really-really can't think of anything else except the session is not enabled. But since you've now enabled session state so I really can't think of anything else.

That's really-really strange..I've deployed more than 5 websites using CS.NET with custom host header and never had any problems. What can it be?

 

Nov 17, 2009 at 6:08 AM

Woohaaa.....

Issue is resolved.

I had to create the host header on 80 port.

If I create host header on port other than 80, it could not recognize the session variables. I will post the reason of this later.

Thanks for your help though.