DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 21 Aug 2007 03:48:46 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    pamela fluente
          2    Patrice http://www.chez.com/scribe/
                 3    Patrice http://www.chez.com/scribe/
          4    Kevin Spencer
          5    pamela fluente
          6    pamela fluente


How to detect missing page or object from code   
I have placed a button on a page to open a pdf stored on another
site.

When the user clicks on the button I do a Redirect to the pdf URL
.... and this seems to work fine.

Question: is this the best way to do that ?

In case the PDF file,   http://My.server.com/MyPdf.pdf  is not on the
server
how can I detect this condition within the program and inform the
user, instead of letting
him to receive an error page ?

-P
Date:Tue, 21 Aug 2007 03:48:46 -0700   Author:  

Re: How to detect missing page or object from code   
You could use System.net.WebClient to send HTTP requests to this third party 
server (possibly using a HEAD request at a lower level if you want just to 
check for the presence of this file wihtout downloading it).

---
Patrice

"pamela fluente"  a crit dans le message de news: 
1187693326.239309.171010@g4g2000hsf.googlegroups.com...

>
> I have placed a button on a page to open a pdf stored on another
> site.
>
> When the user clicks on the button I do a Redirect to the pdf URL
> ... and this seems to work fine.
>
> Question: is this the best way to do that ?
>
> In case the PDF file,   http://My.server.com/MyPdf.pdf  is not on the
> server
> how can I detect this condition within the program and inform the
> user, instead of letting
> him to receive an error page ?
>
> -P
> 
Date:Tue, 21 Aug 2007 13:16:17 +0200   Author:  

Re: How to detect missing page or object from code   
Create an internediate ASPX page that is returned. The intermediate page 
would use an HttpRequest to attempt to download the PDF file. If it gets 
back a 404 status code, it returns a regular HTML response indicating that 
the file is not found, or whatever you wish to say. Otherwise, it sets the 
Response.ContentType to "application/pdf" and uses Response.BinaryWrite to 
write the PDF file back to the client browser.

-- 
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"pamela fluente"  wrote in message 
news:1187693326.239309.171010@g4g2000hsf.googlegroups.com...

>
> I have placed a button on a page to open a pdf stored on another
> site.
>
> When the user clicks on the button I do a Redirect to the pdf URL
> ... and this seems to work fine.
>
> Question: is this the best way to do that ?
>
> In case the PDF file,   http://My.server.com/MyPdf.pdf  is not on the
> server
> how can I detect this condition within the program and inform the
> user, instead of letting
> him to receive an error page ?
>
> -P
> 
Date:Tue, 21 Aug 2007 07:21:33 -0400   Author:  

Re: How to detect missing page or object from code   
On 21 Ago, 13:16, "Patrice" <http://www.chez.com/scribe/> wrote:

> You could use System.net.WebClient to send HTTP requests to this third party
> server (possibly using a HEAD request at a lower level if you want just to
> check for the presence of this file wihtout downloading it).
>
> ---
> Patrice
>
> "pamela fluente"  a écrit dans le message de news:
> 1187693326.239309.171...@g4g2000hsf.googlegroups.com...
>
>
>
>
>
> > I have placed a button on a page to open a pdf stored on another
> > site.
>
> > When the user clicks on the button I do a Redirect to the pdf URL
> > ... and this seems to work fine.
>
> > Question: is this the best way to do that ?
>
> > In case the PDF file,  http://My.server.com/MyPdf.pdf is not on the
> > server
> > how can I detect this condition within the program and inform the
> > user, instead of letting
> > him to receive an error page ?
>
> > -P- Nascondi testo tra virgolette -
>
> - Mostra testo tra virgolette -


Do you have a simple snippet of this procedure?

Thank you.

-P
Date:Tue, 21 Aug 2007 09:15:18 -0700   Author:  

Re: How to detect missing page or object from code   
Try :

http://msdn2.microsoft.com/en-us/library/ez801hhe.aspx to download the whole 
file (and scroll down to the code samples that shows how to download a gif 
file from a web site). Is it me or is MSDN slow ?

Or :
http://www.eggheadcafe.com/tutorials/aspnet/2c13cafc-be1c-4dd8-9129-f82f59991517/the-lowly-http-head-reque.aspx
if you want just to check that the file is still available

http://en.wikipedia.org/wiki/Http#Request_methods discusses the various HTTP 
method (basically GET gets the whole content, while HEAD will just retrieve 
the header).

---
Patrice


"pamela fluente"  a crit dans le message de news: 
1187712918.166928.169160@k79g2000hse.googlegroups.com...
On 21 Ago, 13:16, "Patrice" <http://www.chez.com/scribe/> wrote:

> You could use System.net.WebClient to send HTTP requests to this third 
> party
> server (possibly using a HEAD request at a lower level if you want just to
> check for the presence of this file wihtout downloading it).
>
> ---
> Patrice
>
> "pamela fluente"  a crit dans le message de 
> news:
> 1187693326.239309.171...@g4g2000hsf.googlegroups.com...
>
>
>
>
>
> > I have placed a button on a page to open a pdf stored on another
> > site.
>
> > When the user clicks on the button I do a Redirect to the pdf URL
> > ... and this seems to work fine.
>
> > Question: is this the best way to do that ?
>
> > In case the PDF file,  http://My.server.com/MyPdf.pdf is not on the
> > server
> > how can I detect this condition within the program and inform the
> > user, instead of letting
> > him to receive an error page ?
>
> > -P- Nascondi testo tra virgolette -
>
> - Mostra testo tra virgolette -


Do you have a simple snippet of this procedure?

Thank you.

-P
Date:Tue, 21 Aug 2007 18:47:51 +0200   Author:  

Re: How to detect missing page or object from code   
On 21 Ago, 18:47, "Patrice" <http://www.chez.com/scribe/> wrote:

> Try :
>
> http://msdn2.microsoft.com/en-us/library/ez801hhe.aspxto download the whole
> file (and scroll down to the code samples that shows how to download a gif
> file from a web site). Is it me or is MSDN slow ?
>
> Or :http://www.eggheadcafe.com/tutorials/aspnet/2c13cafc-be1c-4dd8-9129-f....
> if you want just to check that the file is still available
>
> http://en.wikipedia.org/wiki/Http#Request_methodsdiscusses the various HTTP
> method (basically GET gets the whole content, while HEAD will just retrieve
> the header).
>
> ---
> Patrice
>
> "pamela fluente"  a écrit dans le message de news:
> 1187712918.166928.169...@k79g2000hse.googlegroups.com...
> On 21 Ago, 13:16, "Patrice" <http://www.chez.com/scribe/> wrote:
>
>
>
>
>
> > You could use System.net.WebClient to send HTTP requests to this third
> > party
> > server (possibly using a HEAD request at a lower level if you want just to
> > check for the presence of this file wihtout downloading it).
>
> > ---
> > Patrice
>
> > "pamela fluente"  a écrit dans le message de
> > news:
> > 1187693326.239309.171...@g4g2000hsf.googlegroups.com...
>
> > > I have placed a button on a page to open a pdf stored on another
> > > site.
>
> > > When the user clicks on the button I do a Redirect to the pdf URL
> > > ... and this seems to work fine.
>
> > > Question: is this the best way to do that ?
>
> > > In case the PDF file,  http://My.server.com/MyPdf.pdfis not on the
> > > server
> > > how can I detect this condition within the program and inform the
> > > user, instead of letting
> > > him to receive an error page ?
>
> > > -P- Nascondi testo tra virgolette -
>
> > - Mostra testo tra virgolette -
>
> Do you have a simple snippet of this procedure?
>
> Thank you.
>
> -P- Nascondi testo tra virgolette -
>
> - Mostra testo tra virgolette -


Thanks a lot!

-P
Date:Tue, 21 Aug 2007 11:06:14 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us