mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
* list: added SessionConfig.cs and SessionStateSectionHandler.cs * System.Web/HttpHelper.cs: store the values in an ArrayList to get them in correct order. * System.Web.Configuration/ModuleItem.cs: it's not public. * System.Web.Configuration/ModulesConfiguration.cs: it's not public. * System.Web.SessionState/SessionConfig.cs: * System.Web.SessionState/SessionStateSectionHandler.cs: new files to read <sessionState> configuration. svn path=/trunk/mcs/; revision=12118
76 lines
2.0 KiB
C#
76 lines
2.0 KiB
C#
//
|
|
// System.Web.SessionState.SessionStateSectionHandler
|
|
//
|
|
// Authors:
|
|
// Gonzalo Paniagua Javier ([email protected])
|
|
//
|
|
// (C) 2003 Ximian, Inc (http://www.ximian.com)
|
|
//
|
|
|
|
using System;
|
|
using System.Configuration;
|
|
using System.Web.Configuration;
|
|
using System.Xml;
|
|
|
|
namespace System.Web.SessionState
|
|
{
|
|
class SessionStateSectionHandler : IConfigurationSectionHandler
|
|
{
|
|
public object Create (object parent, object context, XmlNode section)
|
|
{
|
|
//TODO: context?
|
|
SessionConfig config = new SessionConfig (parent);
|
|
if (section.HasChildNodes)
|
|
ThrowException ("No children nodes allowed", section);
|
|
|
|
string attvalue = AttValue ("mode", section, false);
|
|
if (!config.SetMode (attvalue))
|
|
ThrowException ("Invalid mode value", section);
|
|
|
|
if (section.Attributes == null)
|
|
return config;
|
|
|
|
attvalue = AttValue ("cookieless", section);
|
|
if (attvalue != null)
|
|
if (!config.SetCookieLess (attvalue))
|
|
ThrowException ("Invalid cookieless value", section);
|
|
|
|
attvalue = AttValue ("timeout", section);
|
|
if (attvalue != null)
|
|
if (!config.SetTimeout (attvalue))
|
|
ThrowException ("Invalid timeout value", section);
|
|
|
|
attvalue = AttValue ("stateConnectionString", section);
|
|
if (attvalue != null)
|
|
config.SetStateConnectionString (attvalue);
|
|
|
|
attvalue = AttValue ("sqlConnectionString", section);
|
|
if (attvalue != null)
|
|
config.SetSqlConnectionString (attvalue);
|
|
|
|
if (section.Attributes != null && section.Attributes.Count > 0)
|
|
HandlersUtil.ThrowException ("Unknown attribute.", section);
|
|
|
|
return config;
|
|
}
|
|
|
|
// A few methods to save some typing
|
|
static string AttValue (string name, XmlNode node, bool optional)
|
|
{
|
|
return HandlersUtil.ExtractAttributeValue (name, node, optional);
|
|
}
|
|
|
|
static string AttValue (string name, XmlNode node)
|
|
{
|
|
return HandlersUtil.ExtractAttributeValue (name, node, true);
|
|
}
|
|
|
|
static void ThrowException (string message, XmlNode node)
|
|
{
|
|
HandlersUtil.ThrowException (message, node);
|
|
}
|
|
//
|
|
}
|
|
}
|
|
|