hosting a pdf file

hosting a pdf file

am 15.04.2008 19:19:45 von Jesse Aufiero

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!

Re: hosting a pdf file

am 15.04.2008 20:04:41 von lexa

On Apr 15, 7:19=A0pm, "Jesse Aufiero" wrote:
> I want my users to be able to click a link on my asp.net page to open a pd=
f
> document. =A0However, 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. =A0How =
can
> I achieve this? =A0Where must the pdf file be placed, and with what kind o=
f
> security settings?
>
> Thanks!

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

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

Response.BinaryWrite(getContent);

http://support.microsoft.com/kb/307603/EN-US/

Re: hosting a pdf file

am 15.04.2008 20:49:41 von Jesse.Aufiero

On Apr 15, 2:04 pm, Alexey Smirnov wrote:
> On Apr 15, 7:19 pm, "Jesse Aufiero" 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
> > 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!
>
> 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/



thanks! ...and what event would i hook this into? The goal is to let
the user click a hyperlink to open the pdf...

Re: hosting a pdf file

am 15.04.2008 22:46:18 von lexa

On Apr 15, 8:49=A0pm, Jesse.Aufi...@gmail.com wrote:
> On Apr 15, 2:04 pm, Alexey Smirnov wrote:
>
>
>
>
>
> > On Apr 15, 7:19 pm, "Jesse Aufiero" wrote:
>
> > > I want my users to be able to click a link on my asp.net page to open =
a pdf
> > > document. =A0However, 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. =A0=
How can
> > > I achieve this? =A0Where must the pdf file be placed, and with what ki=
nd of
> > > security settings?
>
> > > Thanks!
>
> > Response.ContentType=3D"application/pdf";
> > Response.AddHeader( "content-disposition","attachment;
> > filename=3Dfilename);
> > FileStream sourceFile =3D new FileStream("C:\\PDFs\\" + filename,
> > FileMode.Open);
>
> > long FileSize;
> > FileSize =3D sourceFile.Length;
> > byte[] getContent =3D new byte[(int)FileSize];
> > sourceFile.Read(getContent, 0, (int)sourceFile.Length);
> > sourceFile.Close();
>
> > Response.BinaryWrite(getContent);
>
> >http://support.microsoft.com/kb/307603/EN-US/
>
> thanks! =A0...and what event would i hook this into? =A0The goal is to let=

> the user click a hyperlink to open the pdf...- Hide quoted text -
>
> - Show quoted text -

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

Text=3D"Download PDF"
OnClick=3D"LinkButton_Click"
runat=3D"server"/>

in the code-behind

void LinkButton_Click(Object sender, EventArgs e)
{
...
}

Re: hosting a pdf file

am 16.04.2008 02:27:18 von Jesse.Aufiero

On Apr 15, 4:46 pm, Alexey Smirnov wrote:
> On Apr 15, 8:49 pm, Jesse.Aufi...@gmail.com wrote:
>
>
>
> > On Apr 15, 2:04 pm, Alexey Smirnov wrote:
>
> > > On Apr 15, 7:19 pm, "Jesse Aufiero" 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
> > > > 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!
>
> > > 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/
>
> > thanks! ...and what event would i hook this into? The goal is to let
> > the user click a hyperlink to open the pdf...- Hide quoted text -
>
> > - Show quoted text -
>
> Jesse, use the LinkButton control to create a link, and create an
> event handler for the Click event
>
> > Text="Download PDF"
> OnClick="LinkButton_Click"
> runat="server"/>
>
> in the code-behind
>
> void LinkButton_Click(Object sender, EventArgs e)
> {
> ....
>
> }

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