Last active
April 22, 2018 14:35
-
-
Save mataprasad/b1f20e924c8c2d98c5bbd7bbf96de57c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GetFullPictureUrl(Guid? guid) | |
{ | |
if (guid == null) | |
{ | |
guid = Guid.Empty; | |
} | |
return ResolveServerUrl(System.Web.VirtualPathUtility.ToAbsolute("~/home/picture/" + guid.ToString()), false); | |
} | |
public static string ResolveServerUrl(string serverUrl, bool forceHttps) | |
{ | |
if (serverUrl.IndexOf("://") > -1) | |
return serverUrl; | |
string newUrl = serverUrl; | |
Uri originalUri = System.Web.HttpContext.Current.Request.Url; | |
newUrl = (forceHttps ? "https" : originalUri.Scheme) + | |
"://" + originalUri.Authority + newUrl; | |
return newUrl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment