如何在asp.net中设置会话值 [英] How to session set value in asp.net

查看:105
本文介绍了如何在asp.net中设置会话值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好......



如何在asp.net中使用Jquery设置会话值。?



我在客户端有总工作,我在asp.net中设置会话值。?



我要做什么..?



或者在asp.net???div class =h2_lin>解决方案

中使用ajax帖子保存会话值的任何其他选项你可以打电话给


.ajax() [ ^ ],这是jQuery调用Web服务的简便方法。



那么你需要一个WebMethod,它将需要2个字符串,会话变量名和你想要设置它的会话值。



另外,请确保在您的web方法中启用会话,如下所示:

 [WebMethod(EnableSession =  true )] 

因为默认情况下,如果没有它,您将无法访问会话。


Hello...

How to session value set using Jquery in asp.net.?

I have total work on client side and i have set session value in asp.net.?

What i to do..?

Or any other option available to save session value using ajax post in asp.net??

解决方案

You would call


.ajax()[^], which is jQuery's easy way of calling a web service.

Then you'll need a WebMethod that will take 2 Strings, the Session variable name and the session value you want to set it to.

Also, make sure to enable the session in your webmethod, like this:

[WebMethod(EnableSession = true)]

because by default, you won't be able to access the session without that.


这篇关于如何在asp.net中设置会话值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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