I am working on a webpage in C# on VS2010.
I have a gridview that is populated from a database. While loading the gridview Columns I take away the local address of the file and give it the server name where the local file will be found. so if its local path is E:/secureDocs/depositions/file a.pdf the path that anyones computer can use is \\dmzwimkeweb01\securedocs\depostions\file a.pdf
<Columns >
<asp:BoundField DataField="docTypeName" HeaderText="Type" />
<asp:TemplateField HeaderText="Name" >
<ItemTemplate>
<a href='<%#Utility.Clean(((String)Eval("docPath")).Replace("e:", "\\dmzwimkeweb01")) %>'><%# ((String)Eval("docname")).Replace("|^||^||^||^||^||^||^||^|", "'")%></a>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="pageName" HeaderText="Folder" />
<asp:BoundField DataField="docCreateDate" HeaderText="Date" HtmlEncode="false" DataFormatString="{0:MM/dd/yyyy}" />
</Columns>
However when I click the link that goes into the column it takes me to
h_ttp://dmzwimkeweb01/secureDocs/depositions/file%20a.pdf
So now the slashes are the wrong way (dont know if this matters) and it takes me to ‘http://’ when it should just be a link to a server on the network and it puts %20 in where there is a space in the filename. Also when I click the link it tries to open it in IE instead of opening a pdf reader
So again what I want the link to be is: \\dmzwimkeweb01\securedocs\depostions\file a.pdf
Assuming that whoever clicks your link has access to the network file location, make your link look like this:
<a href="file:///dmzwimkeweb01/securedocs/depositions/file a.pdf">My link</a>The slashes will indeed go “the wrong way” as the specification for URLs is different than Microsoft’s path specification. Hope this helps! 🙂