我在我的ASP.Net MVC2应用程序中使用AppFabric作为会话状态提供程序,我希望它也使用本地缓存.我在config.ctions节点后面的web.config中有以下条目:
<dataCacheClient>
<localCache
isEnabled="true"
sync="TimeoutBased"
objectCount="100000"
ttlValue="300" />
<hosts>
<host name="127.0.0.1" cachePort="22233"/>
</hosts>
</dataCacheClient>
Run Code Online (Sandbox Code Playgroud)
我在web.config中也有以下条目作为system.web节点的子节点:
<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
<providers>
<add name="AppFabricCacheSessionStoreProvider" type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider" cacheName="Default" sharedId="DefaultId"/>
</providers>
</sessionState>
Run Code Online (Sandbox Code Playgroud)
不幸的是,如果我在会话中添加一些内容然后在AppFabric powershell中运行以下两个命令,那么我添加到会话数据中的任何内容都不再存在,这让我相信它没有使用本地缓存:
Stop-CacheCluster
Start-CacheCluster
Run Code Online (Sandbox Code Playgroud)
我还尝试使用以下代码使用AppFabric缓存对象,在启动和停止CacheCluster之后,不再缓存一次缓存的对象:
var factory = new DataCacheFactory();
var cache = factory.GetCache("Default");
cache.Put("Key", "Test");
Run Code Online (Sandbox Code Playgroud)
但是,如果我使用以下代码实例化AppFabric,我明确告诉它使用本地缓存而不是依赖web.config条目它可以工作:
var servers = new List<DataCacheServerEndpoint>(1) { new DataCacheServerEndpoint("127.0.0.1", 22233) };
var configuration = new DataCacheFactoryConfiguration {
Servers = servers,
LocalCacheProperties = new DataCacheLocalCacheProperties(100000, new TimeSpan(0, 30, 0), DataCacheLocalCacheInvalidationPolicy.TimeoutBased)
};
var factory = new DataCacheFactory(configuration);
var cache …Run Code Online (Sandbox Code Playgroud) 我来自LAMP世界,那里的"缓存一切"心态很普遍.一切都放在memcache中.
我正在使用ASP.NET MVC和SQL Server开始一个新项目.我可能会使用LINQ to SQL或Entity Framework.我现在需要做出有关缓存的设计决策吗,或者如果有必要,是否可以轻松开始使用Velocity?为了清楚起见,我说的是微软的Velocity缓存,而不是Apache Velocity模板引擎.
我希望我暂时可以忽略缓存,因为学习C#,ASP.NET MVC,LINQ,IIS,SQL Server,并且熟练掌握VS,这样可以保持我的版本.
我想知道是否有像memcached,velocity或sharedcache这样的分布式缓存系统允许我用不仅仅是它的名称标记内容,或者可以将项目与彼此关联,所以如果我使一个项目的缓存无效它也会使相关项目无效.
例如.如果我有两个引用相同数据并且数据发生变化的页面,我希望两个引用页面的缓存无效.
编辑:我在asp.net上
是否存在可用于以编程方式控制Firefox的.NET可访问(即.NET或COM)库?我正在寻找类似于IE的ShDocVw.dll的东西。不必做太多事情,基本上我想要做的就是以编程方式添加书签。
是否有powershell命令:
我没有遇到一个很好的博客或教程,初学者可以开始使用Appfabric缓存管理.
谢谢!
我目前正在设计一个系统,我们需要知道用户是否还在线/登录.
该系统是基于.Net网络,所以我们打算做到这一点使用AJAX/JSONP代码,其中坪的服务器,每2分钟.
有大量用户,因此每2分钟一次ping会导致ca. 每秒600 ping.
因此,我们打算将此服务放在它自己的服务器上,并使用Velocity将所有信息存储在内存中.
缓存将是命名值对的第一组,第一组然后是人,以及每个人的时间戳.
问题是我们可以直接写入每个ping的速度缓存吗?或者这会导致锁定吗?我们应该首先写入队列然后从队列中更新缓存吗?
在我们更新缓存的同时,将有其他用户基于每个组请求信息.
我有一些问题可能对其他人也有帮助.
好.我正在处理在VBScript上编写的经典ASP应用程序.我试图过滤可能来自编码查询字符串的可能的XSS.
我有一个简单的XSS消除函数[getUserInput].这会查找像<> /'....这样的特殊字符,并用空格替换它们.这非常有效.
但是,当我输入通过Server.URLEncode(VBScript)或转义(Javascript)编码的内容时,显然我的上述过滤器不起作用.
我想知道推荐的解决方案,以防止这种Unicode转换输入使我的页面容易受到XSS的攻击.
Repro步骤:
<%
Response.Write getUserInput(Request("txt1")) + "<br/>"
Response.Write Server.URLEncode(getUserInput(Request("txt1"))) + "<br/>"
'the below line is where I am trying to decode and echo the input
Response.Write URLDecode2((getUserInput(Request("txt1")))) + "<br/>"
Response.Write "<br/>"
%>
<html>
Try any of the below two encoded strings in the input box and hit the button. </br></br>
alert('hi') </br>
%3Cscript%3Ealert%28%27hi%27%29%3C%2Fscript%3E <br/>
alert(document.cookie) </br>
%3Cscript%3Ealert%28document.cookie%29%3C%2Fscript%3E <br/>
</br>
<form method="get" name="form1" id="form1" action="#" onSubmit="CallOnLoad()">
<input type='text' name='txt1' id='txt1' />
<button name='btn' type='submit' id='btn'>Hitme</button>
</form>
</html> …Run Code Online (Sandbox Code Playgroud) 我有一个隐藏的表单,这个加载一个子表单,2e表单也应该被隐藏
请注意:我最不习惯
ShowInTaskbar = false; // should be hidden too
Run Code Online (Sandbox Code Playgroud)
如果我使用(隐藏/可见),我最能够在表单之间进行通信,直到它的可见=真;
this.SetParameterValueCallback += new SetParameterValueDelegate(ShowMain.SetParamValueCallbackFn);
ShowMain.AddItemCallback = new AddItemDelegate(this.AddItemCallbackFn);
//Showsub.Show();
Showsub.Hide(); // not working
Run Code Online (Sandbox Code Playgroud)
到目前为止我已经尝试过
this.Visible = false; // didnt work
BeginInvoke(new MethodInvoker(delegate
{
Hide();
})); // didnt work
base.SetVisibleCore(false); // didnt work, Im not able communicate between form
Run Code Online (Sandbox Code Playgroud) 我在2009年将MS的Velocity视为内存缓存解决方案.从那时起,它已经在AppFabric解决方案中得到了应用,该解决方案可以执行许多操作,包括缓存.我已经"回路测试"了MemCached,并发现它有点不稳定.
我的问题是:我们只是在寻找一个缓存解决方案,只是想知道哪个更快起床和运行,哪一个比另一个更可靠?还有其他选择吗?
请使用以下代码:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
namespace Test
{
public partial class _Default : System.Web.UI.Page
{
private List<Customer> CustomerList;
protected void Page_Load(object sender, EventArgs e)
{
// Quickly Illustrate Creation of a List of that contains information;
//CustomerList = (!this.IsPostBack) ? new List<Customer>() : new List<Customer>((Customer[])ViewState["Customers"]);
if (IsPostBack)
CustomerList = new List<Customer>((Customer[])ViewState["Customers"]);
else
CustomerList = new List<Customer>();
// Convert …Run Code Online (Sandbox Code Playgroud) appfabric ×7
.net ×5
c# ×3
caching ×2
memcached ×2
architecture ×1
asp-classic ×1
asp.net ×1
asp.net-mvc ×1
firefox ×1
tagging ×1
unicode ×1
vbscript ×1
winforms ×1
xss ×1