ASP.NET使用JSON进行响应时获得<pre> tag</pre>

时间:2012-11-12 15:31:17

标签: asp.net vb.net json

编辑2:我发现有些回复提到修改'数据类型',是一个标题?我确实尝试将Content-Type修改为application/json但没有帮助。

编辑:我仍然遇到这个问题,只是为了添加这些信息我发送文件作为输入,这里是我发送的HTTP标题,我知道'Accept'标题不是问题,因为我有另一个没有引起任何问题的请求:

Host: localhost:26479 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://localhost:26479/Home/FileUploadBrowser Content-Type: multipart/form-data; boundary=---------------------------41184676334 Content-Length: 1104

我有以下控制器方法(仍在进行中):

Function uploadFileToAmazon(ByVal key As String) As ActionResult
        Dim incomingStream As Stream = Me.Request.InputStream
        Dim bucketName As String = ""
        Dim accessKey As String = ""
        Dim secretKey As String = ""
        ConnectToAmazon(bucketName, accessKey, secretKey)
        Dim client As AmazonS3 = Amazon.AWSClientFactory.CreateAmazonS3Client(accessKey, secretKey, RegionEndpoint.USEast1)
        Dim titledRequest As PutObjectRequest
        titledRequest = New PutObjectRequest

        With titledRequest
            .WithBucketName(bucketName)
            .WithKey(key)
            .WithInputStream(incomingStream)
        End With
        Dim response As S3Response = client.PutObject(titledRequest)
        Return Json(New With {Key .success = "true", Key .msg = "uploaded"})
    End Function

原始问题: 这是我遇到的问题,由于某种原因,它在完成<pre>{"success":"true","msg":"uploaded"}</pre>后向前端发送以下消息。我很困惑,这个<pre>标签来自哪里以及如何摆脱它?谢谢

0 个答案:

没有答案