本文整理汇总了C#中Page.ResolveUrl方法的典型用法代码示例。如果您正苦于以下问题:C# Page.ResolveUrl方法的具体用法?C# Page.ResolveUrl怎么用?C# Page.ResolveUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page.ResolveUrl方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckPrivilege
public static bool CheckPrivilege(Page page, Enums.ModuleKey moduleKey, Enums.Privilege enPriv)//,object privilegeTable
{
DataTable dt = page.Session["AdminFunction"] as DataTable;
try
{
//if ((page.Session["Users"] as NT.Entities.User).IsSuperManager == "yes")//如果是超级管理员
// return true;
}
catch
{
page.Response.Write("<script>parent.location='" + page.ResolveUrl("~/Admin/Login.aspx") + "'</script>");
return false;
}
if (dt.Rows.Count == 0)
{
page.Response.Redirect("~/Admin/NoRights.aspx");
return false;
}
DataRow[] rows = dt.Select(string.Format("ModuleKey='{0}' and PrivilegeId={1}",moduleKey.ToString(),(int)enPriv));
if (rows != null && rows.Length > 0)
{
return true;
}
else
{
page.Response.Redirect("~/Admin/NoRights.aspx");
return false;
}
}
示例2: RegistrarScriptIncludes
public static void RegistrarScriptIncludes(Page page)
{
ClientScriptManager sm = page.ClientScript;
foreach (var item in Constantes.ScriptIncludes)
{
if (!sm.IsClientScriptIncludeRegistered(item.Key))
sm.RegisterClientScriptInclude(item.Key, page.ResolveUrl(item.Value));
}
}
示例3: OpenViewObjectPageInNewWindow
/// <summary>
/// Emits javascript to open the edit page in VIEW (read-only) mode in new window.
/// </summary>
/// <param name="page">The Page object.</param>
/// <param name="objectType">The type of object.</param>
/// <param name="additionalQueryString">Additional query strings to be
/// appended to the end of the URL.</param>
public static void OpenViewObjectPageInNewWindow(Page page, string objectType, string unencryptedGuid, string additionalQueryString)
{
OFunction function = OFunction.GetFunctionByObjectType(objectType);
Window.Open(
page.ResolveUrl(function.EditUrl) + "?N=" + HttpUtility.UrlEncode(Security.Encrypt("NewView")) + "&ID=" +
HttpUtility.UrlEncode(Security.Encrypt("VIEW:" + unencryptedGuid)) +
"&TYPE=" + HttpUtility.UrlEncode(Security.Encrypt(objectType)) +
"&" + additionalQueryString, "AnacleEAM_Window_New");
}
示例4: OpenAddObjectPage
/// <summary>
/// Emits javascript to open the edit page in NEW (create) mode, but
/// the edit page does not automatically create the object.
/// <para>
/// </para>
/// NOTE: DO NOT pass in N=? as part of the querystring, as this will
/// cause the new object passed in to be lost.
/// </summary>
/// <param name="page">The Page object.</param>
/// <param name="newObject">The new PersistentObject created outside of the object panel.</param>
/// <param name="additionalQueryString">Additional query strings to be
/// appended to the end of the URL.</param>
public static void OpenAddObjectPage(Page page, PersistentObject newObject, string additionalQueryString)
{
page.Session["::SessionObject::"] = newObject;
OFunction function = OFunction.GetFunctionByObjectType(newObject.GetType().BaseType.Name);
Window.Open(
page.ResolveUrl(function.EditUrl) + "?ID=" +
HttpUtility.UrlEncode(Security.Encrypt("NEW2:")) +
"&TYPE=" + HttpUtility.UrlEncode(Security.Encrypt(newObject.GetType().BaseType.Name)) +
"&" + additionalQueryString, "Simplism_Window");
}
示例5: RegistrarScriptInclude
public static void RegistrarScriptInclude(Page page, string key, string url)
{
ClientScriptManager sm = page.ClientScript;
if (!sm.IsClientScriptIncludeRegistered(key))
sm.RegisterClientScriptInclude(key, page.ResolveUrl(url));
}
示例6: GetHomepageUrl
//public static string GetAuthUsername()
//{
// return HttpContext.Current.User.Identity.Name.Split('\\')[1];
//}
/// <summary>
/// Get Screen code of current page
/// </summary>
/// <returns></returns>
public static string GetHomepageUrl(Page page)
{
return String.Format("http://{0}{1}", HttpContext.Current.Request.Url.Authority, page.ResolveUrl("~/"));
}
示例7: GetReturnUrlParam
//public static bool TryParse(this Guid g, string s, out Guid gu)
//{
// gu = Guid.Empty;
// if(string.IsNullOrEmpty(s)) { return false;}
// if(s.Length != 36) { return false; }
// try
// {
// gu = new Guid(s);
// }
// catch(FormatException) { return false; }
// catch(OverflowException) { return false; }
// return true;
//}
public static string GetReturnUrlParam(Page page, string siteRoot)
{
// only allow return urls that are relative or start with the site root
//http://www.mojoportal.com/Forums/Thread.aspx?thread=5314&mid=34&pageid=5&ItemID=2&pagenumber=1#post22121
if (page.Request.Params.Get("returnurl") != null)
{
string returnUrlParam = page.Request.Params.Get("returnurl");
if (returnUrlParam.Contains(","))
{
returnUrlParam = returnUrlParam.Substring(0, returnUrlParam.IndexOf(","));
}
if (!String.IsNullOrEmpty(returnUrlParam))
{
returnUrlParam = SecurityHelper.RemoveMarkup(returnUrlParam);
string returnUrl = page.ResolveUrl(SecurityHelper.RemoveMarkup(page.Server.UrlDecode(returnUrlParam)));
if ((returnUrl.StartsWith("/"))&&(!(returnUrl.StartsWith("//"))))
{
return returnUrl;
}
if (
(returnUrl.StartsWith(siteRoot))
|| (returnUrl.StartsWith(siteRoot.Replace("https://", "http://")))
)
{
return returnUrl;
}
}
}
return string.Empty;
}
示例8: GetProfileAvatarLink
public static string GetProfileAvatarLink(
Page page,
object objUserId,
int siteId,
String avatar,
String toolTip)
{
string result = string.Empty;
if (objUserId != null)
{
int userId = Convert.ToInt32(objUserId);
if ((avatar == null) || (avatar == String.Empty))
{
avatar = "blank.gif";
}
String avaterImageMarkup = "<img title='" + toolTip
+ "' alt='" + toolTip + "' src='"
+ page.ResolveUrl("~/Data/Sites/" + siteId.ToString(CultureInfo.InvariantCulture) + "/useravatars/" + avatar)
+ "' />";
result = "<a title='" + toolTip + "' href='"
+ GetNavigationSiteRoot()
+ "/ProfileView.aspx?userid="
+ userId.ToString(CultureInfo.InvariantCulture) + "'>"
+ avaterImageMarkup + "</a>";
}
return result;
}
示例9: GetImageSiteRoot
//public static string GetRegexRelativeImageUrlPatern()
//{
// return "^" + WebUtils.GetSiteRoot() + @"/.*[_a-zA-Z0-9]+\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF)$";
//}
public static string GetImageSiteRoot(Page page)
{
//TODO: could implenent support for using a CDN
string imageRoot = page.ResolveUrl("~/");
if (imageRoot.EndsWith("/")) { imageRoot = imageRoot.Remove(imageRoot.Length - 1, 1); }
return imageRoot;
}
示例10: GetJQueryUIBasePath
public static string GetJQueryUIBasePath(Page page)
{
if (WebConfigSettings.UseGoogleCDN)
{
return "//ajax.googleapis.com/ajax/libs/jqueryui/" + WebConfigSettings.GoogleCDNjQueryUIVersion + "/";
}
if (ConfigurationManager.AppSettings["jQueryUIBasePath"] != null)
{
string jqueryBasePath = ConfigurationManager.AppSettings["jQueryUIBasePath"];
return page.ResolveUrl(jqueryBasePath);
}
return string.Empty;
}