2009-08-09 4 views
1

Server.Transfer를()를 실행하는 동안 왜 예외를 얻고는 ...의 asp.net Server.Transfer를() 예외

Server.Transfer(@"~/Student/StudentSendMail.aspx?username=" + username); 

{Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.} 
+0

무슨 일이 있었는지 어떤 생각이없는에 Server.Transfer를 이동)

3

를 무시됩니다. 그러나 때로는 try catch 블록을 제거하는 것이 해결책이 될 수 있습니다. 확인해 봐. –

+0

Ajax 프레임 워크의 컨트롤을 페이지에 추가 할 때 이런 현상이 발생합니다. –

답변

5

원인 중 하나 이 이상한 오류 메시지는 try-catch 블록 내부에서 Server.Transfer를 수행 중입니다. 너무 catch 블록에서)

Server.Transfer(@"~/Student/StudentSendMail.aspx?username=" + username, false); 

2 종류 System.Threading.ThreadAbortException의 예외를 캐치하고 아무것도하지 않는 :

1)과 같이 false로 설정된 두 번째 인수를 추가하는 처리하는 방법이 몇 가지 있습니다 예외는 Finally 블록

+1

거짓 매개 변수와 관련이 없습니다. 그것은 형식을 보존하기위한 것입니다. response.reirect boolean과 혼동스러워합니다. –