meds
meds

Reputation: 22956

Turn a aspx page to a link?

I have the following in XAML:

<Setter Property="Source" Value="ResourceHttpHandler.aspx" />

What I'd like to do in the HTTP handler is send back a link to a logo (such as url.com/abc.png) and replace ResourceHttpHandler.aspx with the link to that logo.

This is my current attempt:

  public void ProcessRequest( HttpContext _HttpContext )
  {
     try
     {
        HttpRequest request = _HttpContext.Request;
        HttpResponse response = _HttpContext.Response;
        response.ContentType = MimeTypes.TextHTML;
        response.Cache.SetExpires( DateTime.Now );
        response.AppendHeader( "Content-Disposition", MimeDispositions.Inline );

        if( request.HttpMethod == WebRequestMethods.Http.Get )
        {
           response.Write("http://www.google.com/intl/en_com/images/srpr/logo3w.png");
           response.Flush();
        }
     }
     catch( Exception e )
     {
        _HttpContext.Response.Clear( );
        _HttpContext.Response.Write( HttpResponseString.CreateError( e.Message ) );
        _HttpContext.Response.Flush( );
     }
  }

How do I do that?

Upvotes: 1

Views: 80

Answers (1)

Emond
Emond

Reputation: 50692

Perhaps simply redirecting would solve your problem.

Response.Redirect("http://www.google.com/intl/en_com/images/srpr/logo3w.png");

Upvotes: 2

Related Questions