Files
mono/mcs/class/System.Web/System.Web.UI/BaseParser.cs
T
Gonzalo Paniagua Javier 8e35e3a7b9 2002-12-20 Gonzalo Paniagua Javier <[email protected]>
* System.Web/HttpCookie.cs: send 'expires' in the header.
	* System.Web.Security/FormsAuthenticationModule.cs: remove debug lines.
	* System.Web.UI/BaseParser.cs: a couple of path fixes to make it work
	when the page is not in the root directory.
	* System.Web.Util/UrlUtils.cs: fixed IsRelativeUrl and IsRootUrl.

svn path=/trunk/mcs/; revision=9797
2002-12-20 13:49:48 +00:00

85 lines
1.4 KiB
C#
Executable File

//
// System.Web.UI.BaseParser.cs
//
// Authors:
// Duncan Mak ([email protected])
// Gonzalo Paniagua Javier ([email protected])
//
// (C) 2002 Ximian, Inc. (http://www.ximian.com)
//
using System.IO;
using System.Web;
using System.Web.Util;
namespace System.Web.UI
{
public class BaseParser
{
private HttpContext context;
private string baseDir;
private string baseVDir;
private string vPath;
internal string MapPath (string path)
{
return MapPath (path, true);
}
internal string MapPath (string path, bool allowCrossAppMapping)
{
if (context == null)
throw new HttpException ("context is null!!");
return context.Request.MapPath (path, context.Request.ApplicationPath, allowCrossAppMapping);
}
internal string PhysicalPath (string path)
{
if (Path.DirectorySeparatorChar != '/')
path = path.Replace ('/', '\\');
return Path.Combine (BaseDir, path);
}
internal HttpContext Context
{
get {
return context;
}
set {
context = value;
}
}
internal string BaseDir
{
get {
if (baseDir == null)
baseDir = MapPath (BaseVirtualDir, false);
return baseDir;
}
}
internal string BaseVirtualDir
{
get {
if (baseVDir == null)
baseVDir = UrlUtils.GetDirectory (context.Request.FilePath);
return baseVDir;
}
}
internal string CurrentVirtualPath
{
get {
return vPath;
}
}
}
}