Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

issue with singleton method in calling WCF using JQuery -


i created bare simple method, increments number 1 , returns value.

    [servicecontract] public interface icalc {     [operationcontract]     [webget(uritemplate = "getnumber")]     int getnextnumber(); 

service class:

 [servicebehavior(instancecontextmode = instancecontextmode.single)] public class calculator : icalc {     int = 1;      public int getnextnumber()     {return i++; } } 

the service hosted using webhttpbinding , works when opened browser. example, when browse http://localhost:8083/calc/getnumber ,

  <int xmlns="http://schemas.microsoft.com/2003/10/serialization/">1</int>  

every time refresh, value keeps incrementing 1 in xml response (as expected due singleton behavior)

problem

when call same service using jquery as:

$.ajax(             {                 type: "get",                  url: "http://localhost:8083/calc/getnumber",                 data: "",                 contenttype: "application/html",                 processdata: true,                 success: function (msg) { alertresult(alert(msg.childnodes[0].xml)) }             }          ); 

i keep getting same (latest) number , debugger not invoked @ service.

what not understanding is: if method not getting called using jquery, how getting valid output , if method called why increment not taking place (which works if invoke service hitting service url directly browse)r???

thanks!

try adding cache: false properties of ajax request force browser request url everytime otherwise every sane browser cache response request url doesn't change.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -