On Error Resume Next 는 ASP에서 발견한 오류를 무시하고 다음 문장을 실행하는 경우 사용한다.
예시) startAction()실행중 에러가 발생하더라도 startAction()의 에러를 무시하고 진행하게 된다.
만약 에러를 무시하지 않으면 에러메시지가 나타나는 화면을 보게되고 맨 마지막 문장은 실행이 안될것이다.
////////////////////////////
response.write "함수실행 전"
startAction()
response.write "함수실행 후"
Function startAction()
Dim postdata, url, xmlHttp, statusText
postdata = "P_MID=" & P_MID & "&P_TID=" & P_TID
url ="https://test.com"
On Error Resume Next
Set xmlHttp = CreateObject("Msxml2.XMLHTTP")
xmlHttp.open "post",url, False
xmlHttp.setRequestHeader "Connection", "close"
xmlHttp.setRequestHeader "Content-Length", Len(postdata)
xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=euc_kr"
xmlHttp.Send postdata
statusText = xmlHttp.responseBody
End Function
////////////////////////////
'ASP' 카테고리의 다른 글
[ASP] http 접속 체크 방법 - ServerVariables 사용 (0) | 2022.07.21 |
---|---|
[ASP] Server.Execute 사용 (0) | 2022.05.25 |
[ASP] Split을 통해 배열생성 및 응용 (0) | 2022.04.07 |
[ASP] 맨 마지막 글자 날리기 (0) | 2022.03.31 |