Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

hosting a pdf file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jesse Aufiero - 15 Apr 2008 18:19 GMT
I want my users to be able to click a link on my asp.net page to open a pdf
document.  However, I do not want them to be able to enter in a url that
goes directly to the pdf file, thereby bypassing my log on screen.  How can
I achieve this?  Where must the pdf file be placed, and with what kind of
security settings?

Thanks!
Alexey Smirnov - 15 Apr 2008 19:04 GMT
> I want my users to be able to click a link on my asp.net page to open a pdf
> document.  However, I do not want them to be able to enter in a url that
[quoted text clipped - 3 lines]
>
> Thanks!

Response.ContentType="application/pdf";
Response.AddHeader( "content-disposition","attachment;
filename=filename);
FileStream sourceFile = new FileStream("C:\\PDFs\\" + filename,
FileMode.Open);

long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);
sourceFile.Close();

Response.BinaryWrite(getContent);

http://support.microsoft.com/kb/307603/EN-US/
Jesse.Aufiero@gmail.com - 15 Apr 2008 19:49 GMT
> > I want my users to be able to click a link on my asp.net page to open a pdf
> > document.  However, I do not want them to be able to enter in a url that
[quoted text clipped - 19 lines]
>
> http://support.microsoft.com/kb/307603/EN-US/

thanks!  ...and what event would i hook this into?  The goal is to let
the user click a hyperlink to open the pdf...
Alexey Smirnov - 15 Apr 2008 21:46 GMT
On Apr 15, 8:49 pm, Jesse.Aufi...@gmail.com wrote:

> > > I want my users to be able to click a link on my asp.net page to open a pdf
> > > document.  However, I do not want them to be able to enter in a url that
[quoted text clipped - 24 lines]
>
> - Show quoted text -

Jesse, use the LinkButton control to create a link, and create an
event handler for the Click event

<asp:LinkButton id="LinkButton1"
          Text="Download PDF"
          OnClick="LinkButton_Click"
          runat="server"/>

in the code-behind

void LinkButton_Click(Object sender, EventArgs e)
{
....
}
Jesse.Aufiero@gmail.com - 16 Apr 2008 01:27 GMT
> On Apr 15, 8:49 pm, Jesse.Aufi...@gmail.com wrote:
>
[quoted text clipped - 42 lines]
>
> }

if you are interested in consulting, i have a small project that i
could use some assistance with.  let me know if you are interested:
jesse.aufiero@gmail.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.