Unable to open local files in Edge

fp2021 1 Reputation point

I have a .NET 4.0 web application that allows users to view local files by clicking on hyperlinks from a gridview. The application is using "file://server/folder/document" to open network shared files. Everything works fine in Internet Explorer but the hyperlinks are not clickable in Edge. I believe "file://" is being blocked in modern browsers. Can someone offer any suggestions how to resolve this issue without having install browser extensions or modify security policies?

Protected Sub FileGrid_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles FileGrid.RowDataBound
    If e.Row.RowType = ListItemType.AlternatingItem Or e.Row.RowType = ListItemType.Item Then
        Dim fiCurrent As FileInfo = e.Row.DataItem
        Dim lnkFile As HyperLink = e.Row.FindControl("hlFile")
        lnkFile.NavigateUrl = "\\server\folder\"& fiCurrent.Name
    End If
End Sub

<asp:GridView ID="FileGrid"   runat="server">
        <asp:TemplateField HeaderText="Attachment Name">
                <asp:HyperLink ID="hlFile" runat="server" Target="_blank"></asp:HyperLink>
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
1,845 questions
ASP.NET Web Forms
ASP.NET Web Forms
A part of the ASP.NET web application framework that can be used to create ASP.NET web applications.
411 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
7,024 questions
A set of technologies in the .NET Framework for building web applications and XML web services.
1,211 questions
No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 28,281 Reputation points

    The chrome plug-in required to get local file links working.

    Your web server could act as a proxy, it could return server links that when clicked, return the file as an attachment. If the users need write access, then you could look at a WebDAV server.

  2. Yijing Sun-MSFT 7,026 Reputation points

    Hi @fp2021 ,

    works fine in Internet Explorer but the hyperlinks are not clickable in Edge.

    It's not an issue but a comman behavior of modern browsers that we can't link to file protocol from a page serving in http protocol for security reasons. I also find a post discussing about this. This behavior is by design.

    The best practice is serving the file you want to open on local network with http protocol and link it with http protocol. Then you can open it without any issue.

    Best regards,
    Yijing Sun

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments