我使用Web方法開發了一個VB.NET中的Web服務,該方法接受字符串作爲必須採用XML文檔形式的參數。將XML的字符串表達式傳遞給IIS上的Web服務
我可以打開瀏覽器並調用服務,它提供了我需要傳遞字符串的文本框。
只要我通過複製我的XML並粘貼到框中,然後單擊調用傳遞任何XML字符串,我會得到一個錯誤。即使我在最簡單的XML表單中放入一個字符串,例如只有一個節點,我也會得到這個結果。
這是錯誤:
System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (Xmlin="<?xml version="1.0" ..."). at System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection) at System.Web.HttpValueCollection.EnsureKeyValidated(String key) at System.Web.HttpValueCollection.Get(String name) at System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection) at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
它實際上是一種防止惡意輸入的保護。您需要禁用輸入驗證 –