今天看StarterKit.Communities中的关于获取路径部分,发现一个问题?难道老外也会不仔细看MSDN,还是?
这是调用页的代码:
--
string requestPath = CommunityGlobals.RemovePathInfo(Context.Request.Path.ToLower());
--
CommunityGlobals.cs中
---
//*********************************************************************
//
// RemovePathInfo Method
//
// Removes the extended information after a page path.
// For example, removes the Web service information after
// the .asmx file name.
//
//*********************************************************************
public static string RemovePathInfo(string requestPath) {
string _pathInfo = HttpContext.Current.Request.PathInfo;
if (_pathInfo.Length == 0)
return requestPath;
return requestPath.Substring(0, requestPath.Length - _pathInfo.Length);
}
---
大家看到了吧,老外没用用HttpRequest.FilePath来得到不带附加资源的url,呵呵
--
string requestPath = CommunityGlobals.RemovePathInfo(Context.Request.Path.ToLower());
--
CommunityGlobals.cs中
---
//*********************************************************************
//
// RemovePathInfo Method
//
// Removes the extended information after a page path.
// For example, removes the Web service information after
// the .asmx file name.
//
//*********************************************************************
public static string RemovePathInfo(string requestPath) {
string _pathInfo = HttpContext.Current.Request.PathInfo;
if (_pathInfo.Length == 0)
return requestPath;
return requestPath.Substring(0, requestPath.Length - _pathInfo.Length);
}
---
大家看到了吧,老外没用用HttpRequest.FilePath来得到不带附加资源的url,呵呵