PRB: ThreadAbortException x?y ra n?u b?n s? d?ng Response.End, Response.Redirect ho?c Server.Transfer

D?ch tiu ? D?ch tiu ?
ID c?a bi: 312629 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

Tri?u ch?ng

N?u b?n s? d?ng Response.End, Response.Redirect, ho?c phng php Server.Transfer , m?t ngo?i l? ThreadAbortException x?y ra. B?n c th? s? d?ng m?t tuyn b? th?-b?t ? n ngo?i l? ny.

Nguyn nhn

Cc phng php Response.End k?t thc th?c hi?n trang v thay ?i th?c hi?n ? cc s? ki?n Application_EndRequest trong ?ng ?ng d?n s? ki?n c?a ?ng d?ng. D?ng m? sau Response.End khng ?c th?c hi?n.

V?n ? ny x?y ra trong cc phng php Response.Redirect v Server.Transfer b?i v? c? hai phng php g?i Response.End trong n?i b?.

Gi?i php

? lm vi?c xung quanh v?n ? ny, s? d?ng m?t trong nh?ng phng php sau y:
  • Cho Response.End, g?i l HttpContext.Current.ApplicationInstance.CompleteRequest phng php thay v? Response.End ? b? qua vi?c th?c hi?n m? ? cc Application_EndRequest s? ki?n.
  • Cho Response.Redirect, s? d?ng m?t t?nh tr?ng qu t?i, Response.Redirect (chu?i url, bool endResponse) m i sai ?i v?i cc endResponse tham s? ? ngn ch?n cc cu?c g?i n?i b? ? Response.End. V d?:
      Response.Redirect ("nextpage.aspx", false);
    						
    N?u b?n s? d?ng workaround ny, m? m sau Response.Redirect ?c thi hnh.
  • Cho Server.Transfer, s? d?ng cc Server.Execute phng php ? thay th?.

T?nh tr?ng

Hnh vi ny l do thi?t k?.

Thu?c tnh

ID c?a bi: 312629 - L?n xem xt sau cng: 30 Thang Tam 2012 - Xem xt l?i: 3.0
p d?ng
  • Microsoft ASP.NET 4.5
  • Microsoft ASP.NET 4.0
  • Microsoft ASP.NET 3.5
  • Microsoft ASP.NET 2.0
  • Microsoft ASP.NET 1.1
  • Microsoft ASP.NET 1.0
T? kha:
kbexcepthandling kbprb kbmt KB312629 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny: 312629

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com