





{"id":1584,"date":"2010-12-01T23:48:56","date_gmt":"2010-12-02T03:48:56","guid":{"rendered":"http:\/\/www.killtest.hk\/?p=1584"},"modified":"2010-12-01T23:48:56","modified_gmt":"2010-12-02T03:48:56","slug":"asp-net","status":"publish","type":"post","link":"https:\/\/www.killtest.hk\/index.php\/killtest\/asp-net\/","title":{"rendered":"asp.net\u7372\u5f97\u8def\u5f91\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>HttpContext.Current.Request.PhysicalPath;\u00a0\u00a0\u00a0 \/\/ \u7372\u5f97\u7576\u524d\u9801\u9762\u7684\u5b8c\u6574\u7269\u7406\u8def\u5f91.\u6bd4\u5982<\/p>\n<p>\u3000\u3000F:\\XFU.NSQS\\project\\website\\Default.aspx<\/p>\n<p>\u3000\u3000HttpContext.Current.Request.PhysicalApplicationPath; \/\/ \u7372\u5f97\u7576\u524d\u7a0b\u5e8f\u904b\u884c\u7684\u7269\u7406\u8def\u5f91\u6bd4<\/p>\n<p>\u3000\u3000\u5982F:\\XFU.NSQS\\project\\website\\<\/p>\n<p>\u3000\u3000HttpContext.Current.Server.MapPath(@&#8221;\\&#8221;); \u9019\u500b\u5c31\u662f\u5728\u9801\u9762\u4e2d\u7684MapPath\u4e86.\u58f9\u6a23\u7528\u6cd5<\/p>\n<p>\u3000\u3000HttpRuntime.AppDomainAppPath \/\/\u9019\u500b\u662f\u65b0\u767c\u73fe\u7684,\u5f88\u597d\u7528.<\/p>\n<p>\u3000\u3000\u9084\u6709\u58f9\u500b\u662f\u7528\u4f86\u8655\u7406\u5728asp.net\u4e2d\u8abf\u7528dll\u6587\u4ef6,\u800cDLL\u6587\u4ef6\u5982\u679c\u60f3\u77e5\u9053\u7576\u524d\u7684web\u7ad9\u9ede\u7684\u5de5\u4f5c\u76ee\u9304\u53ef\u4ee5\u7528<\/p>\n<p>\u3000\u3000System.AppDomain.CurrentDomain.BaseDirectory<\/p>\n<p>\u3000\u3000\u7db2\u7ad9\u5728\u670d\u52d9\u5668\u78c1\u76e4\u4e0a\u7684\u7269\u7406\u8def\u5f91: HttpRuntime.AppDomainAppPath<\/p>\n<p>\u3000\u3000\u865b\u64ec\u7a0b\u5e8f\u8def\u5f91: HttpRuntime.AppDomainAppVirtualPath<\/p>\n<p>\u3000\u3000HttpContext.Current.Request.ApplicationPath\u865b\u64ec\u61c9\u7528\u7a0b\u5e8f\u6839\u8def\u5f91<\/p>\n<p>\u3000\u3000HttpContext.Current.Server.MapPath(&#8220;.&#8221;)\u7576\u524d\u7684\u7d55\u5c0d\u8def\u5f91<\/p>\n<p>\u3000\u3000HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath)\u7cfb\u7d71\u7684\u6839\u76ee\u9304<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u7576\u524d\u8acb\u6c42\u7684\u865b\u64ec\u8def\u5f91: {0}&#8221;,Server.HtmlEncode<\/p>\n<p>\u3000\u3000(Request.CurrentExecutionFilePath)));<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u7372\u53d6\u7576\u524d\u61c9\u7528\u7a0b\u5e8f\u7684\u6839\u76ee\u9304\u8def\u5f91: {0}&#8221;,<\/p>\n<p>\u3000\u3000Server.HtmlEncode(Request.ApplicationPath)));<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u7576\u524d\u8acb\u6c42\u7684\u865b\u64ec\u8def\u5f91: {0}&#8221;,Server.HtmlEncode<\/p>\n<p>\u3000\u3000(Request.FilePath)));<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u7576\u524d\u8acb\u6c42\u7684\u865b\u64ec\u8def\u5f91: {0}&#8221;,Server.HtmlEncode<\/p>\n<p>\u3000\u3000(Request.Path)));<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u7372\u53d6\u7576\u524d\u6b63\u5728\u57f7\u884c\u7684\u61c9\u7528\u7a0b\u5e8f\u7684\u6839\u76ee\u9304\u7684\u7269\u7406\u6587\u4ef6\u7cfb\u7d71\u8def\u5f91:<\/p>\n<p>\u3000\u3000{0}&#8221;, Server.HtmlEncode(Request.PhysicalApplicationPath)));<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u7372\u53d6\u8207\u8acb\u6c42\u7684 URL \u76f8\u5c0d\u61c9\u7684\u7269\u7406\u6587\u4ef6\u7cfb\u7d71\u8def\u5f91: {0}&#8221;,<\/p>\n<p>\u3000\u3000Server.HtmlEncode(Request.PhysicalApplicationPath)));<\/p>\n<p>\u3000\u3000\u7576\u524d\u8acb\u6c42\u7684\u865b\u64ec\u8def\u5f91: \/aDirectory\/Sample\/responseHtml.aspx<\/p>\n<p>\u3000\u3000\u7372\u53d6\u7576\u524d\u61c9\u7528\u7a0b\u5e8f\u7684\u6839\u76ee\u9304\u8def\u5f91: \/aDirectory<\/p>\n<p>\u3000\u3000\u7576\u524d\u8acb\u6c42\u7684\u865b\u64ec\u8def\u5f91: \/aDirectory\/Sample\/responseHtml.aspx<\/p>\n<p>\u3000\u3000\u7576\u524d\u8acb\u6c42\u7684\u865b\u64ec\u8def\u5f91: \/aDirectory\/Sample\/responseHtml.aspx<\/p>\n<p>\u3000\u3000\u7372\u53d6\u7576\u524d\u6b63\u5728\u57f7\u884c\u7684\u61c9\u7528\u7a0b\u5e8f\u7684\u6839\u76ee\u9304\u7684\u7269\u7406\u6587\u4ef6\u7cfb\u7d71\u8def\u5f91: E:\\Visual Studio 2005\\<\/p>\n<p>\u3000\u3000\u7372\u53d6\u8207\u8acb\u6c42\u7684 URL \u76f8\u5c0d\u61c9\u7684\u7269\u7406\u6587\u4ef6\u7cfb\u7d71\u8def\u5f91: E:\\Visual Studio 2005\\\\aDirectory\\<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u7372\u53d6\u9805\u76ee\u5b8c\u6574\u7684\u7d55\u5c0d\u8def\u5f91: {0}&#8221;,<\/p>\n<p>\u3000\u3000System.AppDomain.CurrentDomain.BaseDirectory.ToString()));<\/p>\n<p>\u3000\u3000\/\/\u50c5\u5728\u5617\u8a66\u5411\u6b64\u57df\u4e2d\u52a0\u8f09\u7a0b\u5e8f\u96c6\u4e4b\u5f8c\uff0c\u6b64\u5c6c\u6027\u624d\u53ef\u7528<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u7372\u53d6\u9805\u76ee,\u5b83\u7531\u7a0b\u5e8f\u96c6\u6c96\u7a81\u89e3\u6c7a\u7a0b\u5e8f\u7528\u4f86\u63a2\u6e2c\u52d5\u614b\u5275\u5efa\u7684\u7a0b\u5e8f\u96c6: {0}&#8221;, System.AppDomain.CurrentDomain.DynamicDirectory));<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u7372\u53d6\u78c1\u76e4\u4e0a\u6307\u5411\u61c9\u7528\u7a0b\u5e8f\u76ee\u9304\u7684\u7269\u7406\u8def\u5f91\u3002: {0}&#8221;,<\/p>\n<p>\u3000\u3000System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath));<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u7372\u53d6\u61c9\u7528\u7a0b\u5e8f\u7684\u865b\u64ec\u6839\u8def\u5f91: {0}&#8221;,<\/p>\n<p>\u3000\u3000System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath));<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u7372\u53d6\u7ad9\u9ede\u7684\u540d\u7a31\u3002: {0}&#8221;,<\/p>\n<p>\u3000\u3000System.Web.Hosting.HostingEnvironment.SiteName));<\/p>\n<p>\u3000\u3000\/\/sb.Append(string.Format(&#8220;\u7372\u53d6\u6b64\u61c9\u7528\u7a0b\u5e8f\u7684\u865b\u64ec\u8def\u5f91\u63d0\u4f9b\u7a0b\u5e8f\u3002: {0}&#8221;,<\/p>\n<p>\u3000\u3000System.Web.Hosting.HostingEnvironment.VirtualPathProvider));<\/p>\n<p>\u3000\u3000sb.Append(string.Format(&#8220;\u8fd4\u56de\u8207 Web \u670d\u52d9\u5668\u4e0a\u7684\u6307\u5b9a\u865b\u64ec\u8def\u5f91\u76f8\u5c0d\u61c9\u7684\u7269\u7406\u6587\u4ef6\u8def\u5f91\u3002: {0}&#8221;, Server.MapPath(&#8220;sss.aspx&#8221;)));<\/p>\n","protected":false},"excerpt":{"rendered":"<p>HttpContext.Current.Request.PhysicalPath;\u00a0\u00a0\u00a0 \/\/ \u7372\u5f97\u7576\u524d\u9801\u9762\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[638,639],"class_list":["post-1584","post","type-post","status-publish","format-standard","hentry","category-killtest","tag-asp-net","tag-639"],"_links":{"self":[{"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/posts\/1584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/comments?post=1584"}],"version-history":[{"count":0,"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/posts\/1584\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/media?parent=1584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/categories?post=1584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.killtest.hk\/index.php\/wp-json\/wp\/v2\/tags?post=1584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}