1
親愛的如何設置asp.net Web服務方法中的響應狀態?如何在asp.net web服務方法中設置響應狀態
<WebMethod()> _
<Script.Services.ScriptMethod(responseFormat:=Script.Services.ResponseFormat.Json)> _
Public Function HelloWorld(ByVal name As String, ByVal userID As String, ByVal email As String, ByVal department As String, ByVal password1 As String) As String
Dim result As String
Try
Dim param(6) As SqlParameter
param(0) = New SqlParameter("@RefId", 1)
param(1) = New SqlParameter("@Name", name)
param(2) = New SqlParameter("@UserName", userID)
param(3) = New SqlParameter("@Email", email)
param(4) = New SqlParameter("@Department", department)
param(5) = New SqlParameter("@Password", password1)
' param(6) = New SqlParameter("@CreatedBy", "")
result = SqlHelper.ExecuteNonQuery(connStringShareMe, Data.CommandType.StoredProcedure, "Users_Insert", param)
Return "Done"
Catch ex As Exception
Return "500"
Return result
End Try
End Function
我想返回500狀態碼作爲迴應我該怎麼辦?