Skip to main content

Posts

Showing posts from February, 2014

Making Sense of ASP.NET Paths

Nice article found on the following path about Asp.Net Paths. Ref: http://weblog.west-wind.com/posts/2009/Dec/21/Making-Sense-of-ASPNET-Paths Request Property Description and Value ApplicationPath Returns the web root-relative logical path to the virtual root of this app. /webstore/ PhysicalApplicationPath Returns local file system path of the virtual root for this app. c:\inetpub\wwwroot\webstore PhysicalPath Returns the local file system path to the current script or path . c:\inetpub\wwwroot\webstore\admin\paths.aspx Path FilePath CurrentExecutionFilePath All of these return the full root relative logical path to the script page including path and scriptname. CurrentExcecutionFilePath will return the ‘current’ request path after a Transfer/Execute call while FilePath will always return the original request’s p

How to get all html img tag (image) src uri from a html content?

public List<string> GetAllImageUri(string content) {     string pattern = @"<(?<Tag_Name>img)\b[^>]*?\b(?<URL_Type>(?(1)src))\s*=\s*(?:""(?<URL>(?:\\""|[^""])*)""|'(?<URL>(?:\\'|[^'])*)')";       // Getting collection of matched uri.     MatchCollection imageUriCollection = Regex.Matches(content, pattern, RegexOptions.IgnoreCase);       if (imageUriCollection.Count > 0)     {           return imageUriCollection.Cast<Match>() .Select(x => x.Groups["URL"].Value) .ToList();     }     return null; }