A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
,
<%# GetFileLength(Container.CurrentPage["varFilePath"].ToString())%>
aspx.cs
public string GetFileLength(string FilePath)
{
string _getFileInfo = "";
try
{
FileInfo finfo = new FileInfo(Server.MapPath(FilePath));
long FileInKB = finfo.Length / 1024;
_getFileInfo = FileInKB.ToString();
}
catch (NotSupportedException)
{
}
catch (ArgumentException)
{
}
catch (IOException)
{
}
catch(HttpException)
{
}
return _getFileInfo;
}
<%#getlink(container.currentpage)%>
, (<%# container.currentpagedatepublication ="null?((DateTime)Container.CurrentPage["DatePublication"]).ToString("d"):" no publication data available>)
File Size: <%#container.currentpage["varfilepath"]%> kb
%#container.currentpage["varfilepath"]%>%#>%#getlink(container.currentpage)%>
I am trying to extract the file size of the file which I will then display in the last line inside the NewsTemplate. Does anyone know how to do this using the Container reference as it is a list inside a NewsList? I researched and wonder if the answer is in the FileInfo class. Maybe something along the following could work but it isn't.ascx <%# getfilelengthcontainer.currentpage> kb ascx.cs public string GetFileLength(PageData pdFileInfo) { FileInfo fi = new FileInfo(pdFileInfo.Property["varFilePath"].ToString()); return fi.Length.ToString(); } %#>Any better ideas anyone? Thanks. Victor