I have dynamic URL Links to PDFs attachments. Whenever the user is going to Upload file on the server the folder is created for that profile and attachments are saved there etc. The name of the file is saved in the Database.
I am usign DetailsView to present a lot of information and I want to have a link to the PDF in one of the fields. In the db I have <a href="~/Files/xxx.pdf"> Open PDF</a> record saved. The aspx page that displays the data is in the folder 'Customers'. because
of that the link to the PDF instead of "http://localhost:3094/Files/xxx.pdf" is like http://localhost:3094/Customers/Files/xxx.pdf"
I have dynamic URL Links to PDFs attachments. Whenever the user is going to Upload file on the server the folder is created for that profile and attachments are saved there etc. The name of the file is saved in the Database.
I am usign DetailsView to present a lot of information and I want to have a link to the PDF in one of the fields. In the db I have <a href="~/Files/xxx.pdf"> Open PDF</a> record saved. The aspx page that displays the data is in the folder 'Customers'. because
of that the link to the PDF instead of "http://localhost:3094/Files/xxx.pdf" is like http://localhost:3094/Customers/Files/xxx.pdf"
The ideal solution would be to store only the path in the database; the anchor tag and text can be in the page itself. That way, when binding the url to a control you can use a server control and ensure that ~/ works correctly, pointing to the site root.
What code are you using to display this? Can you post the binding code for the link?
MSObserver
Member
5 Points
14 Posts
Embed URL Link value from Database in aspx page
Apr 23, 2012 01:06 PM|LINK
Hi,
I have dynamic URL Links to PDFs attachments. Whenever the user is going to Upload file on the server the folder is created for that profile and attachments are saved there etc. The name of the file is saved in the Database.
I am usign DetailsView to present a lot of information and I want to have a link to the PDF in one of the fields. In the db I have <a href="~/Files/xxx.pdf"> Open PDF</a> record saved. The aspx page that displays the data is in the folder 'Customers'. because of that the link to the PDF instead of "http://localhost:3094/Files/xxx.pdf" is like http://localhost:3094/Customers/Files/xxx.pdf"
How can I get rid of the folder "Customers"?
piram
Member
127 Points
151 Posts
Re: Embed URL Link value from Database in aspx page
Apr 23, 2012 01:15 PM|LINK
So you solved it?
MSObserver
Member
5 Points
14 Posts
Re: Embed URL Link value from Database in aspx page
Jun 20, 2012 09:49 PM|LINK
Hi,
No, because I don't know to get rid of 'Customers' folder.
ahmadhamdan1...
Member
125 Points
32 Posts
Re: Embed URL Link value from Database in aspx page
Jun 20, 2012 10:21 PM|LINK
Can you show us the code?
also try to convert the relative url to an absolute one when you read it, by using
Dave Sussman
All-Star
37716 Points
5005 Posts
ASPInsiders
MVP
Re: Embed URL Link value from Database in aspx page
Jun 21, 2012 07:57 AM|LINK
The ideal solution would be to store only the path in the database; the anchor tag and text can be in the page itself. That way, when binding the url to a control you can use a server control and ensure that ~/ works correctly, pointing to the site root.
What code are you using to display this? Can you post the binding code for the link?