I have created a header data retriever where the user enters the URL and it returns size in mb
My code works fine but it does not shows the floating value
if (long.TryParse(resp.Headers.Get("Content-Length"), out ContentLength))
{
string File_Size;
if (ContentLength >= 1073741824)
{
result = ContentLength / 1073741824;
kbmbgb.Text = "GB";
}
else if (ContentLength >= 1048576)
{
result = ContentLength / 1048576;
kbmbgb.Text = "MB";
}
else if (ContentLength >= 1024)
{
result = ContentLength / 1024;
kbmbgb.Text = "KB";
}
else
{
result = ContentLength;
kbmbgb.Text = "BYTE";
}
File_Size = result.ToString("0.00");
sizevaluelabel.Text = File_Size;
}