I can not open the link for my grid view

0

I made the following code

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ID_PTD" DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display.">
        <Columns>
            <asp:BoundField DataField="CAMINHO" HeaderText="CAMINHO" SortExpression="CAMINHO" />
            <asp:BoundField DataField="NOME" HeaderText="NOME" SortExpression="NOME" />
            <asp:BoundField DataField="PROFESSOR" HeaderText="PROFESSOR" SortExpression="PROFESSOR" />
            <asp:BoundField DataField="ETEC" HeaderText="ETEC" SortExpression="ETEC" />
            <asp:BoundField DataField="DATA" HeaderText="DATA" SortExpression="DATA" />
            <asp:TemplateField HeaderText="Documentos">
            <EditItemTemplate>
                        <a ID="hpCaminho" class="materialize-textarea"  href ='<%# Bind("CAMINHO") %>' runat="server">Abrir</a>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <a ID="hpCaminho" class="materialize-textarea"  href ='<%# Bind("CAMINHO") %>' runat="server">Abrir</a>
                    </ItemTemplate>  
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

It runs without errors in my visual studio, however, clicking the link in the grid view does not happen

We can see that in the lower left corner it shows the path, but when I click open it does not open, why it does not open and how can I resolve it

    
asked by anonymous 10.01.2018 / 00:45

1 answer

1

You can not open a local file on the user's machine through a link, for security reasons this is blocked in most browsers

If you open the console, you will certainly see an error similar to "Not allowed to load local resource"

What you can do is to map this directory to your server and provide a relative path or, for example, create a method that will read this file in the physical path of the server and return the stream to the user for download. p>     

10.01.2018 / 01:39