会话变量可以容纳的最大大小是多少? [英] What is the maximum size a session variable can hold?

查看:28
本文介绍了会话变量可以容纳的最大大小是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

会话变量可以容纳的最大大小是多少?我正在尝试将对象存储在会话变量中,如果对象大小低于 80 KB,则工作正常,如果大小大于 80 KB,则在检索时出现异常.

What is the maximum size a session variable can hold ? I am trying to store object in session variable, if object size is under 80 KB, then working fine and if the size is greater than 80 KB then on retrieval I am getting an exception.

如何增加会话变量大小?

How can I increase the session variable size?

这种行为是在我的生产服务器上,在开发机器上我可以存储超过 500 KB 等的大对象.

This behaviour is on my production server, on the development machine I can store big objects like above 500 KB etc..

我正在实施类似...http://aspalliance.com/1221_CodeSnip_Uploading_Multiple_Files_At_Once.all

这是我的代码:

private static int count = 0;

protected void Upload_Click(object sender, EventArgs e)
{
    for (int loopCount = 0; loopCount < count; loopCount++)
    {
        HtmlInputFile hif = (HtmlInputFile)Session["myupload" + loopCount];
        String filePath = Server.MapPath("~/AdvImages/") + loopCount.ToString() + "_" + hif.PostedFile.FileName;
        hif.PostedFile.SaveAs(filePath);
        Session.Abandon();
    }
}
protected void btnAdd_Click1(object sender, EventArgs e)
{
    Session["myupload" + count] = FileUpload1;
    count++;
}

谢谢

推荐答案

尝试将 requestLengthDiskThreshold 更改为:

Try to change requestLengthDiskThreshold to this:

<system.web>
    <httpRuntime executionTimeout="90" 
                 maxRequestLength="20000" 
                 useFullyQualifiedRedirectUrl="false" 
                 requestLengthDiskThreshold="8192"/>
</system.web>

这篇关于会话变量可以容纳的最大大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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