c# - Image path have special characters when it's bind to gridview -
i trying bind images grid-view path stored in database.
lets path stored in database ../images/products/scenttower.png
when image bind grid view path appears format
`../images/products/scenttower%0d.png`
what causing that?
<itemtemplate> <asp:image id="imagecontrol" runat="server" imageurl='<%# eval("picture") %>' /> </itemtemplate>
%0d
carriage return character (\n
). there line break in file name. don't know operating system allows this, best thing make sure have proper input validation , checks in database prevents unwanted characters in file name.
one way validate file name check on path.getinvalidfilenamechars()
. if don't want input validation, can normalize image url removing or replacing occurrences character in list.
Comments
Post a Comment