Asp.net网站开发中的会话异常

时间:2015-06-15 17:48:54

标签: asp.net session

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;




namespace ConsoleApplication19
{
    class Program
   {
    static void Main(string[] args)
    {
        System.Diagnostics.Process.Start(@"C:\Users\Jenna\Documents\Visual     Studio 2013\Projects\WindowsFormsApplication4\WindowsFormsApplication4\bin\Release\WindowsFormsApplication4.exe");

        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("6");
            Thread.Sleep(500);
            System.Windows.Forms.SendKeys.SendWait("{TAB}");
            Thread.Sleep(500);
            System.Windows.Forms.SendKeys.SendWait("0");
            Thread.Sleep(500);
            System.Windows.Forms.SendKeys.SendWait("{TAB}"); 
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{DOWN}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{DOWN}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{DOWN}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{DOWN}");
        Thread.Sleep(500); 
        System.Windows.Forms.SendKeys.SendWait("{TAB}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{ENTER}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{TAB}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{ENTER}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{TAB}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{TAB}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{BACKSPACE}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("3");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{TAB}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{TAB}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{ENTER}");
        Thread.Sleep(500);
        System.Windows.Forms.SendKeys.SendWait("{TAB}");
        Thread.Sleep(500);


    }
}

1 个答案:

答案 0 :(得分:0)

确保web.config中存在以下内容,以便为您的应用提供SessionState:

<system.webServer>
       <modules runAllManagedModulesForAllRequests="true">
        <remove name="Session" />
        <add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
</system.webServer>