BaseParser.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // System.Web.UI.BaseParser.cs
  3. //
  4. // Authors:
  5. // Duncan Mak ([email protected])
  6. // Gonzalo Paniagua Javier ([email protected])
  7. //
  8. // (C) 2002 Ximian, Inc. (http://www.ximian.com)
  9. //
  10. using System.IO;
  11. using System.Web;
  12. namespace System.Web.UI
  13. {
  14. public class BaseParser
  15. {
  16. private HttpContext context;
  17. private string baseDir;
  18. private string baseVDir;
  19. private string vPath;
  20. internal string MapPath (string path)
  21. {
  22. return MapPath (path, true);
  23. }
  24. internal string MapPath (string path, bool allowCrossAppMapping)
  25. {
  26. return context.Request.MapPath (path, baseVDir, allowCrossAppMapping);
  27. }
  28. internal string PhysicalPath (string path)
  29. {
  30. if (Path.DirectorySeparatorChar != '/')
  31. path = path.Replace ('/', '\\');
  32. return Path.GetFullPath (Path.Combine (baseVDir, path));
  33. }
  34. internal HttpContext Context
  35. {
  36. get {
  37. return context;
  38. }
  39. }
  40. internal string BaseDir
  41. {
  42. get {
  43. if (baseDir == null)
  44. baseDir = MapPath (baseVDir, false);
  45. return baseDir;
  46. }
  47. }
  48. internal string BaseVirtualDir
  49. {
  50. get {
  51. return baseVDir;
  52. }
  53. }
  54. internal string CurrentVirtualPath
  55. {
  56. get {
  57. return vPath;
  58. }
  59. }
  60. }
  61. }