Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
1.44/5 (3 votes)
See more:
What is wrong with this line

<embed id="srcfile" src="PDF/Manual.pdf" width="980" height="1000" type='application/pdf' runat="server"></embed>


I have an aspx page where I have above line which pretty much just opens the PDF

What I have tried:

Earlier, I had my files on the project files. Now they are moved to server. And I cannot get the file open from server.
Posted
Updated 9-Feb-16 3:59am
v2
Comments
Sergey Alexandrovich Kryukov 8-Feb-16 16:36pm    
URI...
—SA
F-ES Sitecore 9-Feb-16 5:35am    
If they're hosted on the server put them in a folder on your site that is public then give the proper url,

/yourfiles/test.pdf

If the files are on the server but not in your iis folders then you'll need a handler that can read the file from its location and stream it to the client, so your url will be something like

/download.ashx?filename=test.pdf

google "asp.net download file via handler" for code.

First, you have 5 slashes after the file: protocol. You need 2 slashes for a UNC path.
<embed id="srcfile" src="file://isc-vmfs01/ClaimsFiles/PDF/User_Manual.pdf" wid...

If the user on the client side doesn't have read permissions to that file share and the folder path under it they're not going to be able to download the file. The HTML code in the browser runs as the user, not the server.


*** This answer may no longer be valid as the original question has now been edited to show something completely different ***
 
Share this answer
 
v2
Comments
sudevsu 9-Feb-16 9:56am    
Its not about downloading the File. I have MEnu item "Manual" On clicking it, it should open the PDF in content page on web application. That's it.
Dave Kreskowiak 9-Feb-16 10:11am    
Yes it is. If the browser cannot download the file, AS THE USER, it cannot show it.
sudevsu 9-Feb-16 10:25am    
I can definitely see that every one has permission to the folder in server.
Now that you've changed the question, you really need to explain what you're doing. All you're doing is asking what's wrong with a certain line of HTML. This does not explain what you're ultimately trying to achieve with this code.

An appropriate solution would be to include a controller for handling file downloads, like PDF files, without having to specify <embed> tags.
 
Share this answer
 
Comments
sudevsu 10-Feb-16 8:16am    
Files having read /write permissions to everyone cannot be opened when embed src is changed to the path of server folder's file. Did that make sense ?
Dave Kreskowiak 10-Feb-16 8:23am    
Nope. Perhaps if you included an example of what you're talking about?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900