ASHX 中的模型绑定?
我有一个 .NET 3.5 webform 项目,想要添加一个通用处理程序 (ashx) 来接受 ajax 调用。我当前的实现让我在处理程序中解析 Request 对象(例如 Request["param"]),以便获取所有查询字符串值。有更好的方法吗?我知道 MVC 项目具有模型绑定功能,并且希望在通用处理程序中使用相同的功能。这可能吗?
总的来说,在通用处理程序中获取查询字符串参数的最佳方法是什么?
I have a .NET 3.5 webform project and want to add a generic handler (ashx) to accept ajax calls. My current implementation has me parsing out the Request object (ex. Request["param"]) in the handler in order to obtain all querystring values. Is there a better way to do this? I know MVC projects have model binding capabilities and would love to utilze that same feature in a generic handler. Is this possible?
Overall, what is the best way to grab querystring parameters in a generic handler?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需简单地使用 Request.QueryString.Get();您可以为 Web 表单构建 MVC 模型绑定流程,但这并不是开箱即用的。另外,您编写了多少个处理程序?如果只有少数,像这样的复杂过程可能会产生开销。
HTH。
Just simply by using Request.QueryString.Get(); you could build the MVC model binding process for web forms, but that isn't available out of the box. Plus, how many handlers do you write? If only a few, a complex process like that may be overhead.
HTH.