Connecting Tech Pros Worldwide Forums | Help | Site Map

Redirecting favicon.ico in the Error 404 handler?

Bill
Guest
 
Posts: n/a
#1: Jul 19 '05
I want to add a favicon.ico to one of my websites. Because this is a large
site, with two domains sharing an IP, I want to be able to redirect the
favicon .ICO file from my VBScript Error 404 file (depending upon the domain
name). Anybody have directions for doing this?


In my Error 404 file, I can place this is the partocilar domain secitons"

-------------------
strQueryString = LCase(getSerVar("QUERY_STRING"))
If InStr(strQueryString, "favicon.ico") <= 0 Then
' WHAT GOES HERE TO PROVIDE THE .ICO FILE?
End If
-------------------

.....Thanks!










Bill
Guest
 
Posts: n/a
#2: Jul 19 '05

re: Redirecting favicon.ico in the Error 404 handler?


Sorry, here is the corrected code - the second line must be > and not <=

[color=blue]
> -------------------
> strQueryString = LCase(getSerVar("QUERY_STRING"))
> If InStr(strQueryString, "favicon.ico") > 0 Then
> ' WHAT GOES HERE TO PROVIDE THE .ICO FILE?
> End If
> -------------------[/color]


Andrew Urquhart
Guest
 
Posts: n/a
#3: Jul 19 '05

re: Redirecting favicon.ico in the Error 404 handler?


*Bill* wrote in microsoft.public.inetserver.asp.general:[color=blue]
> I want to add a favicon.ico to one of my websites. Because this is a large
> site, with two domains sharing an IP, I want to be able to redirect the
> favicon .ICO file from my VBScript Error 404 file (depending upon the domain
> name). Anybody have directions for doing this?
>
> In my Error 404 file, I can place this is the partocilar domain secitons"
>
> -------------------
> strQueryString = LCase(getSerVar("QUERY_STRING"))
> If InStr(strQueryString, "favicon.ico") <= 0 Then
> ' WHAT GOES HERE TO PROVIDE THE .ICO FILE?
> End If
> -------------------
>
> ....Thanks![/color]

You could ADODB stream it, but you might find that the following is
sufficient (as well as faster and more efficient):

Response.ContentType = "image/x-icon"
Server.Transfer("/images/myFavicon.ico")
Response.End()
--
Andrew Urquhart
- FAQ: http://www.aspfaq.com
- Archive: http://tinyurl.com/38kzx (Google Groups)
- Contact me: http://andrewu.co.uk/contact/
Bill
Guest
 
Posts: n/a
#4: Jul 19 '05

re: Redirecting favicon.ico in the Error 404 handler?



"Andrew Urquhart" <useWebsiteInSignatureToReply@com.invalid> wrote in
message news:1wp2uhixoijt8.dlg@usenet.andrewu.co.uk...[color=blue]
> *Bill* wrote in microsoft.public.inetserver.asp.general:[color=green]
> > I want to add a favicon.ico to one of my websites. Because this is a[/color][/color]
large[color=blue][color=green]
> > site, with two domains sharing an IP, I want to be able to redirect the
> > favicon .ICO file from my VBScript Error 404 file (depending upon the[/color][/color]
domain[color=blue][color=green]
> > name). Anybody have directions for doing this?
> >
> > In my Error 404 file, I can place this is the partocilar domain[/color][/color]
secitons"[color=blue][color=green]
> >
> > -------------------
> > strQueryString = LCase(getSerVar("QUERY_STRING"))
> > If InStr(strQueryString, "favicon.ico") <= 0 Then
> > ' WHAT GOES HERE TO PROVIDE THE .ICO FILE?
> > End If
> > -------------------
> >
> > ....Thanks![/color]
>
> You could ADODB stream it, but you might find that the following is
> sufficient (as well as faster and more efficient):
>
> Response.ContentType = "image/x-icon"
> Server.Transfer("/images/myFavicon.ico")
> Response.End()
> --
> Andrew Urquhart
> - FAQ: http://www.aspfaq.com
> - Archive: http://tinyurl.com/38kzx (Google Groups)
> - Contact me: http://andrewu.co.uk/contact/[/color]

THANKS, Andrew! I got that to work, except for the Server.Transfer
statement... I had to do:

Server.Transfer("myFavicon.ico")

Isn't Server.Transfer supposed to be a path, and not a relative URL?

Bill.






Andrew Urquhart
Guest
 
Posts: n/a
#5: Jul 19 '05

re: Redirecting favicon.ico in the Error 404 handler?


*Bill* wrote in microsoft.public.inetserver.asp.general:[color=blue]
> "Andrew Urquhart" <useWebsiteInSignatureToReply@com.invalid> wrote in
> message news:1wp2uhixoijt8.dlg@usenet.andrewu.co.uk...[color=green]
>> *Bill* wrote in microsoft.public.inetserver.asp.general:[color=darkred]
>>> strQueryString = LCase(getSerVar("QUERY_STRING"))
>>> If InStr(strQueryString, "favicon.ico") <= 0 Then
>>> ' WHAT GOES HERE TO PROVIDE THE .ICO FILE?
>>> End If[/color]
>>
>> You could ADODB stream it, but you might find that the following is
>> sufficient (as well as faster and more efficient):
>>
>> Response.ContentType = "image/x-icon"
>> Server.Transfer("/images/myFavicon.ico")
>> Response.End()[/color]
>
> THANKS, Andrew! I got that to work,[/color]

Oh good!
[color=blue]
> except for the Server.Transfer statement... I had to do:
>
> Server.Transfer("myFavicon.ico")
>
> Isn't Server.Transfer supposed to be a path, and not a relative URL?[/color]

It takes a relative path :-)
--
Andrew Urquhart
- FAQ: http://www.aspfaq.com
- Archive: http://tinyurl.com/38kzx (Google Groups)
- Contact me: http://andrewu.co.uk/contact/
Closed Thread