mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 17:10:20 -10:00
* System.Web/HttpApplicationFactory.cs: add the context as parameter when building the application Type. * System.Web/HttpCookie.cs: new internal constructor. * System.Web/HttpCookieCollection.cs: new internal method to make a cookie expire. * System.Web/HttpRequest.cs: MapPath fixes. * System.Web/HttpResponse.cs: implemented ApplyAppPathModifier. * System.Web/HttpRuntime.cs: fixed typo in AppDomainAppVirtualPath. * System.Web.Compilation/AspGenerator.cs: now it uses the current HttpContext when creating user controls. TemplateSourceDirectory is no longer a dummy value. * System.Web.Compilation/GlobalAsaxCompiler.cs: * System.Web.Compilation/PageCompiler.cs: * System.Web.Compilation/UserControlCompiler.cs: set the context which will be used to locate the files. * System.Web.UI/BaseParser.cs: use MapPath and context to locate files. * System.Web.UI/Control.cs: implemented MapPathSecure. * System.Web.UI/TemplateControl.cs: use UrlUtils to generate the path. * System.Web.UI/TemplateControlParser.cs: use the context and MapPath. * System.Web.UI/UserControl.cs: implemented MapPath. * System.Web.UI/UserControlParser.cs: added context parameter to constructor. * System.Web.Util/PathUtil.cs: removed. * System.Web.Util/UrlUtils.cs: fixed Combine to handle '~'. svn path=/trunk/mcs/; revision=9737
190 lines
3.1 KiB
C#
190 lines
3.1 KiB
C#
//
|
|
// System.Web.UI.UserControl
|
|
//
|
|
// Authors:
|
|
// Gonzalo Paniagua Javier ([email protected])
|
|
//
|
|
// (C) 2002 Ximian, Inc (http://www.ximian.com)
|
|
//
|
|
using System;
|
|
using System.Web.Caching;
|
|
using System.Web.SessionState;
|
|
|
|
namespace System.Web.UI
|
|
{
|
|
public class UserControl : TemplateControl, IAttributeAccessor
|
|
{
|
|
private bool initialized;
|
|
private AttributeCollection attributes;
|
|
private StateBag attrBag;
|
|
|
|
public UserControl ()
|
|
{
|
|
//??
|
|
}
|
|
|
|
public HttpApplicationState Application
|
|
{
|
|
get {
|
|
Page p = Page;
|
|
if (p == null)
|
|
return null;
|
|
return p.Application;
|
|
}
|
|
}
|
|
|
|
private void EnsureAttributes ()
|
|
{
|
|
if (attributes == null) {
|
|
attrBag = new StateBag (true);
|
|
if (IsTrackingViewState)
|
|
attrBag.TrackViewState ();
|
|
attributes = new AttributeCollection (attrBag);
|
|
}
|
|
}
|
|
|
|
public AttributeCollection Attributes
|
|
{
|
|
get {
|
|
return attributes;
|
|
}
|
|
}
|
|
|
|
public Cache Cache
|
|
{
|
|
get {
|
|
Page p = Page;
|
|
if (p == null)
|
|
return null;
|
|
return p.Cache;
|
|
}
|
|
}
|
|
|
|
public bool IsPostBack
|
|
{
|
|
get {
|
|
Page p = Page;
|
|
if (p == null)
|
|
return false;
|
|
return p.IsPostBack;
|
|
}
|
|
}
|
|
|
|
public HttpRequest Request
|
|
{
|
|
get {
|
|
Page p = Page;
|
|
if (p == null)
|
|
return null;
|
|
return p.Request;
|
|
}
|
|
}
|
|
|
|
public HttpResponse Response
|
|
{
|
|
get {
|
|
Page p = Page;
|
|
if (p == null)
|
|
return null;
|
|
return p.Response;
|
|
}
|
|
}
|
|
|
|
public HttpServerUtility Server
|
|
{
|
|
get {
|
|
Page p = Page;
|
|
if (p == null)
|
|
return null;
|
|
return p.Server;
|
|
}
|
|
}
|
|
|
|
public HttpSessionState Session
|
|
{
|
|
get {
|
|
Page p = Page;
|
|
if (p == null)
|
|
return null;
|
|
return p.Session;
|
|
}
|
|
}
|
|
|
|
public TraceContext Trace
|
|
{
|
|
get {
|
|
Page p = Page;
|
|
if (p == null)
|
|
return null;
|
|
return p.Trace;
|
|
}
|
|
}
|
|
|
|
[MonoTODO]
|
|
public void DesignerInitialize ()
|
|
{
|
|
throw new NotImplementedException ();
|
|
}
|
|
|
|
public void InitializeAsUserControl (Page page)
|
|
{
|
|
if (initialized)
|
|
return;
|
|
initialized = true;
|
|
WireupAutomaticEvents ();
|
|
FrameworkInitialize ();
|
|
}
|
|
|
|
public string MapPath (string virtualPath)
|
|
{
|
|
return Request.MapPath (virtualPath, TemplateSourceDirectory, true);
|
|
}
|
|
|
|
protected override void LoadViewState (object savedState)
|
|
{
|
|
if (savedState != null) {
|
|
Pair p = (Pair) savedState;
|
|
base.LoadViewState (p.First);
|
|
if (p.Second != null) {
|
|
EnsureAttributes ();
|
|
attrBag.LoadViewState (p.Second);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
protected override void OnInit (EventArgs e)
|
|
{
|
|
if (Page != null)
|
|
InitializeAsUserControl (Page);
|
|
|
|
base.OnInit(e);
|
|
}
|
|
|
|
protected override object SaveViewState ()
|
|
{
|
|
object baseState = base.SaveViewState();
|
|
object attrState = null;
|
|
if (attributes != null)
|
|
attrState = attrBag.SaveViewState ();
|
|
if (baseState == null && attrState == null)
|
|
return null;
|
|
return new Pair (baseState, attrState);
|
|
}
|
|
|
|
string IAttributeAccessor.GetAttribute (string name)
|
|
{
|
|
if (attributes == null)
|
|
return null;
|
|
return attributes [name];
|
|
}
|
|
|
|
void IAttributeAccessor.SetAttribute (string name, string value)
|
|
{
|
|
EnsureAttributes ();
|
|
Attributes [name] = value;
|
|
}
|
|
}
|
|
}
|
|
|