Json Webmethod returns xml RRS feed

  • Question

  • User-1799376286 posted

    I have a webmethod that output in Json but when i view it in brower i get the below line along with the value.

    This XML file does not appear to have any style information associated with it. The document tree is shown below.

    Why if am getting the xml file message above while the webmethod is outputing in json.

    Below is the webmethod code:

      <webmethod()> _ <scriptmethod(responseformat:=responseformat.json)> _ Public Function CheckUsernamePassword(ByVal UserName As String, ByVal Password As String) As String Dim WebServiceAccessPassword As String = "n0bl3h0us3" Dim oIsellMobileLogin As New IsellMobileLoginV3() If WebServiceAccessPassword.Trim() = IsellUtilities.GetWebservicePassword() Then oIsellMobileLogin = IsellMobileLoginV3.CheckUserNameAndPassword(UserName, Password, WebServiceAccessPassword) If oIsellMobileLogin.authenticated Then IsellMopbileAppAnalyticsInsert.LoginAnalyticsInsert(UserName) End If 'if Login Fails Process to send Email If oIsellMobileLogin.authenticated = False Then 'Step 1 Check UserExist or not Dim bUserNameExists As Boolean = False Dim strUserEmailId As String = "" bUserNameExists = IsellMobileLoginV3.UserNameExists(UserName) If bUserNameExists Then 'Check the activity if the mail is send send or not If (IsellMobileLogin.CheckActivityCountForUserNameSameDay(UserName) = "0") Then strUserEmailId = IsellMobileLoginV3.UserEmailId(UserName) If (Not UserName.Contains("_nhm")) Then IsellMobileLoginV3.InsertActivity(UserName) End If 'SendEmail If (IsellMobileLoginV3.CheckUnSuscribeActivityCountForUserName(UserName) = "0") Then IsellMobileLoginV3.SendEmailUser(strUserEmailId, UserName) End If End If End If End If End If Dim sJSON As String = js.Serialize(oIsellMobileLogin) Return sJSON End Function </scriptmethod(responseformat:=responseformat.json)></webmethod()>
    Monday, February 11, 2013 12:12 PM


  • User1289186222 posted

    It depends on the browser, they all interpret differently.  Like if you use IE, then it will not display anything, instead ask you to download a file containing the json.  I think firefox will auto-convert it to xml (not 100% on this) and chrome might do the same.  try it in different browsers and also try connecting from a web page, it should give you json then.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 11, 2013 1:07 PM