ASP.Net Hyperlink navigation URL not including server name

TerDizearneva

New Member
This might be a ridiculously easy question, but it has me stumped. I have a web form where I'm trying to create a hyperlink in the code behind to a file server share, e.g. file://myServer/Shared/, but when the page is rendered, the link doesn't include the server name, i.e. file:///Shared/. I don't know why this happens. Any help or insight is appreciated.UPDATE:Sure, here is the snippet where the link is being set.\[code\] //The link is embedded in a table HyperLink link = (HyperLink)e.Row.Cells[1].Controls[0]; link.NavigateUrl = @"file://myServer/Shared/";\[/code\]As a test, I assigned the link to a string value and the link prints the expected url.\[code\]string foo = link.NavigateUrl;//Displays this"file://myServer/Shared/"\[/code\]I don't know why this doesn't appear when the link is rendered in the final page.UPDATE 2: Ok, so I know I have to set the absolute path in the code-behind, I thought that's what I was doing, but it still won't render correctly.UPDATE 3:I followed pjacobs suggestion about setting the test property and it was actually a step in the right direction. I have the following:\[code\]link.Text = "<a href=http://stackoverflow.com/"file:\\myServer\\Shared\">link text</a>";\[/code\]Now the link gets rendered as follows: \[code\]file:///myServer/Shared\[/code\]. I'm almost there except it gives the extra '/' in front of the server name. I'll keep playing with it, this seems like it should be so simple, I don't understand why ASP.Net renders the URL differently.
 
Back
Top