GridView, HyperLinkFIeld and FILE:// URLs


Url: http://lab.msdn.microsoft.com/productfeedback/v...

I was helping a friend out this evening trying to get a simple GridView working with a HyperLinkField from a database result and we ran into an interesting security feature that people might run into:

If you add a HyperLinkField to a GridView's Columns to allow a hyperlink in a column (pretty standard), it will create hyperlinks unless the URL starts with something other than http:// and https://.  In our case, his DB has an URL of:

FILE://\\somemachine\someshare\somefile.txt

Because it was a full URL but didn't start with http or https, it didn't show the link. Change it to:

\\somemachine\someshare\somefile.txt

If you're interested, there was a Bug Report filed and MS explained why they did it:

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=0400b837-db21-4828-90c7-4df607795501

 



Shawn
Shawn Wildermuth
Author, Teacher, and Coach



My Courses

pluralsight
Building a Web App with ASP.NET Core, MVC6, EF Core, Bootstrap and Angular (updated for 2.0)
Using Visual Studio Code for ASP.NET Core Projects (new)
Implementing and Securing an API with ASP.NET Core
Building a Web App with ASP.NET Core, MVC6, EF Core and AngularJS
Building a Web App with ASP.NET5, MVC6, EF7, and AngularJS (Retired)
Best Practices in ASP.NET: Entities, Validation, and View Models
Webstorm Fundamentals
Front-End Web Development Quick Start
Lessons from Real World .NET Code Reviews
Node.js for .NET Developers

Application Name WilderBlog Environment Name Production
Application Ver 2.0.0.0 Runtime Framework .NETCoreApp,Version=v2.0
App Path D:\home\site\wwwroot\ Runtime Version .NET Core 4.6.26020.03
Operating System Microsoft Windows 10.0.14393 Runtime Arch X86