Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
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));