Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 从.ashx文件重定向响应_.net_Ashx - Fatal编程技术网

.net 从.ashx文件重定向响应

.net 从.ashx文件重定向响应,.net,ashx,.net,Ashx,我有ashx文件,我想从ashx重定向到aspx页面。一些解决方案?使用context.Response.Redirect(newUrl);结果显示一个页面,其中显示: void ProcessRequest(HttpContext context) { context.Response.Redirect(newUrl); } “对象已移动到。” 更新: 这是因为我注销了,在这种情况下,答案是使用FormsAuthentication.RedirectToLoginPage() 我找

我有ashx文件,我想从ashx重定向到aspx页面。一些解决方案?

使用context.Response.Redirect(newUrl);结果显示一个页面,其中显示:

void ProcessRequest(HttpContext context)
{
     context.Response.Redirect(newUrl);
}
“对象已移动到。”

更新:
这是因为我注销了,在这种情况下,答案是使用FormsAuthentication.RedirectToLoginPage()

我找到了一个解决方案,它应该可以正常工作:

context.Response.ContentType = "text/plain";

if (controlcase)
{
    //Write code, what you want...

    context.Response.Write("This is result");
}
else
{
    context.Response.Write("<script>location.href='url you want to redirect'</script>");
}
context.Response.ContentType=“text/plain”;
if(控制案例)
{
//写代码,你想要什么。。。
context.Response.Write(“这是结果”);
}
其他的
{
context.Response.Write(“location.href='url you want redirect'”);
}