Ejemplo n.º 1
0
        public static string GravatarUrl(this UrlHelper url, string email, int size)
        {
            string imageUrl = Settings.Default.DefaultGravatar;
            if (imageUrl.StartsWith("~/"))
            {
                imageUrl = url.Absolute(imageUrl);
            }

            if (string.IsNullOrEmpty(email))
            {
                email = Guid.NewGuid().ToString(); // random image
            }

            string md5 = email.ToLowerInvariant().MD5();

            return string.Format(
                url.RequestContext.HttpContext.Request.IsSecureConnection ? "https://secure.gravatar.com/avatar/{0}.jpg?d={1}&s={2}&r=g" : "http://www.gravatar.com/avatar/{0}.jpg?d={1}&s={2}&r=g",
                md5.ToLowerInvariant(),
                url.Encode(imageUrl),
                size);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets an absolute URL to the specified blog post
 /// </summary>
 /// <param name="urlHelper">The URL helper.</param>
 /// <param name="post">Blog post to link to</param>
 /// <returns>URL to this blog post</returns>
 public static string BlogPostAbsolute(this IUrlHelper urlHelper, PostModel post)
 {
     return urlHelper.Absolute(urlHelper.BlogPost(post));
 }
 /// <summary>
 /// Gets the absolute URL (http://..../blah) to the specified URI
 /// </summary>
 /// <param name="urlHelper">The URL helper</param>
 /// <param name="uri">URI to link to</param>
 /// <returns>The absolute URL</returns>
 public static string ContentAbsolute(this UrlHelper urlHelper, string uri)
 {
     return urlHelper.Absolute(urlHelper.Content(uri));
 }
        public static Uri Absolute(this System.Web.Mvc.UrlHelper url)
		{
			return url.Absolute(string.Empty);
		}
Ejemplo n.º 5
0
        public static Uri Absolute(this UrlHelper url)
		{
			return url.Absolute(string.Empty);
		}
Ejemplo n.º 6
0
        public static string Absolute(this UrlHelper urlHelper, Func<UrlHelper, string> urlFactory)
        {
            string url = urlFactory(urlHelper);

            return urlHelper.Absolute(url);
        }