I pass the the virtual path, but got exception of null refrence. I can get the extention by using VirtualPathUtility.GetExtension(p). I need to get the file size.
eg.
Try with:
var file = HostingEnvironment.VirtualPathProvider.GetFile(p) as UnifiedFile; if (file != null) { size = file.Length; }
Hope this helps.
I pass the the virtual path, but got exception of null refrence. I can get the extention by using VirtualPathUtility.GetExtension(p). I need to get the file size.
eg.
string size=string.Empty;
string extentionIcon=string.Empty;
System.IO.Stream file = VirtualPathMappedProvider.OpenFile(p);
if(file!=null)
size = GetFileSizeString(file.Length);
extentionIcon = GetFileIcon(VirtualPathUtility.GetExtension(p));