2010-01-12 24 views

Trả lời

15
void ProcessRequest(HttpContext context) 
{ 
    context.Response.Redirect(newUrl); 
} 
0

Sử dụng ngữ cảnh.Response.Redirect (newUrl); kết quả trong một trang có nội dung:

"Đối tượng được chuyển đến here".

Cập nhật: Điều này xảy ra vì tôi đã đăng xuất, trong trường hợp đó câu trả lời là sử dụng FormsAuthentication.RedirectToLoginPage();

-1

Tôi tìm thấy một giải pháp và nó sẽ làm việc tốt:

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>"); 
} 
Các vấn đề liên quan