Hi indradeo,
The file you are reading is Excel file not text file.
You can't use DownloadString method of WebClient class.
You need to read the file using the WebRequest class and ClosedXML to read the data from excel file.
Refer below example.
HTML
<asp:GridView ID="gvCustomers" runat="server">
</asp:GridView>
Namespaces
using System.Data;
using System.IO;
using System.Net;
using ClosedXML.Excel;
Code
protected void Page_Load(object sender, EventArgs e)
{
string url = "file://10.1.150.11/Customers.xlsx";
var request = (FileWebRequest)WebRequest.Create(url);
using (var response = request.GetResponse())
{
using (var stream = response.GetResponseStream())
{
using (var output = File.Create(Server.MapPath("test.xlsx")))
{
stream.CopyTo(output);
using (XLWorkbook workBook = new XLWorkbook(stream))
{
IXLWorksheet workSheet = workBook.Worksheet(1);
DataTable dt = new DataTable();
bool firstRow = true;
foreach (IXLRow row in workSheet.Rows())
{
if (firstRow)
{
foreach (IXLCell cell in row.Cells())
{
dt.Columns.Add(cell.Value.ToString());
}
firstRow = false;
}
else
{
dt.Rows.Add();
int i = 0;
foreach (IXLCell cell in row.Cells())
{
dt.Rows[dt.Rows.Count - 1][i] = cell.Value.ToString();
i++;
}
}
gvCustomers.DataSource = dt;
gvCustomers.DataBind();
}
}
}
}
}
}
Screenshot
For more details on reading file from stream refer below article.