所以我需要在发布请求后在变量中将一些数据存储在我的页面(webpart)上。
但是当我尝试声明它为例### call netlogo. Set the path where NetLogo is installed
nl.path <- ("/Applications/NetLogo 5.3.1/") # Mac path
### Start NetLogo
# The /Java directory is where the NetLogo java app lives. Don't set
# completely before to make the models path work
NLStart(file.path(nl.path, "Java"))
时,Visual Studio只是不识别Session["test value"] = someValue;
。我查了一下namespcses,写了可能的一切,但它仍然看不到Session。
我做错了什么? 如果在我的情况下由于某些原因不可能,我应该如何在发布请求后保存变量?静态类不是一个选项,因为他对所有用户只有1个,我需要为不同的用户存储不同的数据。
答案 0 :(得分:1)
可能HttpContext.Current.Session就是你需要的
使用示例:
app.filter('rangePrice', function() {
return function( items, rangePrice ) {
var filteredValue= [];
var toPrice= parseInt(rangePrice.toPrice);
var fromPrice= parseInt(rangePrice.fromPrice);
angular.forEach(items, function(item) {
if( item.product_price>= toPrice&& item.product_price<= toPrice) {
filteredValue.push(item);
}
});
return filteredValue;
};
});
存储数据
HttpContext context = HttpContext.Current;
检索数据
context.Session["FirstName"] = firstName;