Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Session element in Web.Config gets overwritten

  Asked By: Rocco    Date: Sep 16    Category: Sharepoint    Views: 2012

I have created a sharepoint site where I have changed the session
attribute to use <inProc mode> than the default Sqlserver.

If I restart the server the session attribute changes back to the
default one <session mode=SqlServer>.

Can someone help,, as this breaks the whole site and I have to modify
web.config to get the site working.



7 Answers Found

Answer #1    Answered By: Leanne Rios     Answered On: Sep 16

You should not change the web.config file directly. Rather, use the
SPWebConfigModification class to make the changes. Using this class in
the Microsoft.SharePoint.Administration namespace will store the change
in the configuration database. Then, a SharePoint timer job will update
the web.config file (on all required servers).

Answer #2    Answered By: Zachary Roberts     Answered On: Sep 16

Has anyone had any luck using the SPWebConfigModification class in the
case where you need the addition/update to appear in a specific absolute
order? I have a custom solution/feature that requires a web.config
entry added to the httpmodules section as the very 1st item in the list
(I need to do some URL rewriting prior to WSS kicking in), but the order
parameter only affects the relative (e.g. the order of any items added
via the class) not the absolute order.

Answer #3    Answered By: Maura Durham     Answered On: Sep 16

My guess is that your SPWebConfigModification is for the <add> element.
Did you try creating a SPWebConfigModification for the <httpModules>
element? In the Value property, specify the <add> elements as you need
them. This solution would be very brittle. (i.e. If someone deployed an
httpModule, it would likely break yours.)

I always thought that the order of modules should not be important,
since you may not be able to control the order in which they run. Are
you seeing something different?

What do you mean by "WSS kicking in"? Is there functionality in the
SPRequestModule rather than the SPHttpHandler that is noteworthy?

Answer #4    Answered By: Jagat Pandit     Answered On: Sep 16

Yes, I am currently using an <add> element, but I'll give your
suggestion a try. This is a pretty locked down environment (customized
MOSS app in an hosted environment) so the brittleness you mention is
likely not a concern.

In this particular case I'm trying to redirect a request to /_vti_bin/
to selectively direct some of the OOTB web  service URLs to a custom
location (I'm trying to use the OOTB Outlook Contact sync against a
custom list in my app). The order of the modules is very important in
this case, because one of the OOTB modules used by SharePoint also
handles _vti_bin redirection and I need my redirection to happen first.

Answer #5    Answered By: Jerod Carrillo     Answered On: Sep 16

If you know that an OOB module will be rewriting the web  service url,
could you not test for both the original and re-written urls? I believe
that every module gets called, so if you're looking for either url in
the request, you should get a chance to do your thing.

The actual work to generate the response should be in the handler, not
the module. (But I have not looked at the SPRequest handler, so maybe
their making their own rules.

Answer #6    Answered By: Hema Pasupuleti     Answered On: Sep 16

The issue is the original URL path (specifically the portion being
re-written by WSS) is the only clue I have to the fact I need to do my
re-write. Running after the re-write is therefore not an option, and
since modules kick before handlers doing this in a handler is also a
no-go. Believe me, I've tried a whole lots of ways to do this, and
order dependence is the only method that's the least bit reliable for
this particular case. If only I could enforce the order when adding the
module it would be all good...

Answer #7    Answered By: Candis Kinney     Answered On: Sep 16

I will look into this class.
What I add safecontrol entries and proxy settings elements in the
same web.config and they don;t get overwritten.. it's only session
which gets overwritten.

Didn't find what you were looking for? Find more on Session element in Web.Config gets overwritten Or get search suggestion and latest updates.