last day (14 days later) » 

10:31 AM
1
Q: Asp.net web service return json

Gaurav PalI am using below code for my web service. I want return value in json. but this code return value in XML format only. [WebMethod] [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)] public bool login(string uname, string pwd) { SqlConnection con = new SqlConnectio...

 
Anything from config might be doing it?
 
please explain.
 
ResponseFormat.Json is the default return type for ScriptMethod. So unless you specify it shouldn't return xml. So let us see some part of your config(if any).May be something is wrong there.
 
following result shown
This XML file does not appear to have any style information associated with it. The document tree is shown below. <boolean xmlns="tempuri.org/">true</boolean&gt;
i am changing the response format in .json but no change.
 
do you have any config's related?
 
10:31 AM
yes i am using web config file.
 
can post it here?
 
<system.webServer> <defaultDocument> <files> <clear/> <add value="loginpage.aspx"/> </files> </defaultDocument> </system.webServer>
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
 
give me some time, I'll try to reproduce the issue'
 
btw what template did you select from available templates?
 
10:39 AM
i am using .asmx format
hello amit ji
 
what template did you use?
unable find .asmx template
 
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.ServiceModel.Activation;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.Script.Services;
using System.Web.Services;

namespace ClockManagement
{
/// <summary>
/// Summary description for LoginWebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
LoginWebService.asmx file format i am using
in asp.net
 
11:13 AM
hello sir....
are u there
 

last day (14 days later) »