Tuesday, 8 November 2011
Zenab's Tech Blog.Net: ASMX web service is not returning JSON data in IIS...
Zenab's Tech Blog.Net: ASMX web service is not returning JSON data in IIS...: This code was perfectly working and returning json data when was being called from Jquery in IIS 5-6.However when it was deployed to IIS7, ...
Tuesday, 11 October 2011
ASMX web service is not returning JSON data in IIS7
This code was perfectly working and returning json data when was being called from Jquery in IIS 5-6.However when it was deployed to IIS7, it was constantly returning xml response.
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class SomeService : System.Web.Services.WebService
{ public SomeService()
{ //Uncomment the following line if using
designed components //InitializeComponent(); }
[WebMethod] [System.Web.Script.Services.ScriptMethod
(ResponseFormat = ResponseFormat.Json)]
public List<sometype> getlist2()
{ List<sometype> localtaglist =
new List<sometype>(); ... foreach (...)
{ sometype localtag = new sometype(); ... localtaglist.Add(localtag); }
return localtaglist
}
Add following lines of code to the web method and it will successfully
return data in json format. Context.Response.ContentType = "application/json"; JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
Context.Response.ContentType = "application/json";
Context.Response.Write( jsonSerializer.Serialize(localtaglist));
Thursday, 9 June 2011
HTTP Error 404.11 - Not Found The request filtering module is configured to deny a request that contains a double escape sequence.IIS7
<system.webServer> <security> <requestFiltering allowDoubleEscaping="true"> </requestFiltering> </security> </system.webserver>
If your SEO friendly URL contains special characters as + or - and running under IIS7 , you 'll get
this error.
to solve this issue , set allowDoubleEscaping to true in web.config file.
Thursday, 10 February 2011
Intelligencia UrlRewriter and 404 page not found Error
If you are getting this Error with Intelligencia.UrlRewriter and IIS 5/6,Follow these simple steps.
1-Run->inetmgr.
2-Select web site you are working on.
3-Right click on it and select properties.
4-Click on "Configuration" button .
Now we need to tell IIS that aspnet_isapi.dll should also execute those pages which has no aspx extension.
5-From Application Mapping tab , click Add button,in application mapping pop window,browse
,C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll in executable .
6.type .* in extension.
7.Uncheck the"Check that the file exists".
Here we go.........................Run the Site.
Note all web.config configuration should also be done according to rewriter configuration.
1-Run->inetmgr.
2-Select web site you are working on.
3-Right click on it and select properties.
4-Click on "Configuration" button .
Now we need to tell IIS that aspnet_isapi.dll should also execute those pages which has no aspx extension.
5-From Application Mapping tab , click Add button,in application mapping pop window,browse
,C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll in executable .
6.type .* in extension.
7.Uncheck the"Check that the file exists".
Here we go.........................Run the Site.
Note all web.config configuration should also be done according to rewriter configuration.
Subscribe to:
Posts (Atom)