用asp.net静态webmethods调用Jquery Ajax方法 [英] Jquery Ajax method call with asp.net static webmethods

查看:58
本文介绍了用asp.net静态webmethods调用Jquery Ajax方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





这就是我理解Jquery Ajax方法调用如何与asp.net静态Web方法一起使用。



首先创建页面对象或服务器在您尝试加载网页时为页面提供服务。但是,当您从Jquery ajax方法进行ajax调用时,实际上指向一个静态Web方法,该方法无法访问任何页面控件,因为它无法创建页面本身的实例。



我可以这样说 - 这些静态Web方法无法访问页面的控件或其视图状态,因此存在多个请求和并发的危险出现?





您调用静态Web方法,这意味着它没有关联对象使其无状态(为什么他们使用术语无状态吗?),这使得它的工作就像一个服务,它接收数据,处理数据,返回一些东西但不保留任何东西。您也可以选择通过以这种方式获取数据并使用JavaScript来更改网页上存在的控件的状态,因为没有涉及视图状态。



我们可以因此,假设这个工作流程不会导致任何并发访问问题,即使它使用静态方法和字段。



我的理解是否有任何缺陷?。

解决方案

在这里发布这类问题可能更好: ASP.NET论坛 [ ^

Hi,

Here's what I understand how Jquery Ajax method call works with asp.net static web methods.

First the page object is created or server to serve the page when you try to load a webpage. But when you make an ajax call from Jquery ajax method you actually point to a static web method which cannot access any of the page controls as it cannot create an instance of the page in itself.

So can I put it this way - These static web methods cannot access the page's controls or their view state hence the danger of multiple requests and concurrency does not arise?


You call a static web method which means it does not have an associated object making it stateless(why do they use the term stateless?), which there by makes it work like a service which takes data, processes it, and returns something but does not keep anything to itself. Also you can choose to change the state of the controls present on the webpage by getting data in this manner and using JavaScript as there is no view state involved.

We can therefore presume that this workflow will not cause any concurrent access problems even though it uses static methods and fields.

Is there any flaw in my understanding?.

解决方案

It is probably better to post this kind of question here: ASP.NET Forum[^]


这篇关于用asp.net静态webmethods调用Jquery Ajax方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆