将 aspx 页面转换为链接?
我在 XAML 中有以下内容:
<Setter Property="Source" Value="ResourceHttpHandler.aspx" />
我想在 HTTP 处理程序中执行的操作是发送回徽标的链接(例如 url.com/abc.png),并将 ResourceHttpHandler.aspx 替换为该徽标的链接。
这是我目前的尝试:
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( );
}
}
我该怎么做?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许简单地重定向就可以解决您的问题。
Perhaps simply redirecting would solve your problem.