ASP.NET의 세션 시간 초과
IIS 6.0에서 ASP.NET 2.0 응용 프로그램을 실행하고 있습니다. 세션 시간 초과가 기본 20 분이 아닌 60 분이 되길 원합니다. 나는 다음을 수행했다
- web.config에서 설정
- IIS 관리자 / 웹 사이트 속성 /ASP.NET 구성 설정에서 세션 시간 초과를 60 분으로 설정
- 응용 프로그램 풀 속성 / 성능에서 유휴 시간 제한을 60 분으로 설정하십시오.
여전히 20 분에 세션 시간 초과가 발생합니다. 내가해야 할 다른 일이 있습니까?
양식 인증을 사용하고 있습니까?
양식 인증은 시간 초과 (기본적으로 30 분)에 고유 한 값을 사용합니다. 양식 인증 시간 초과는 세션이 계속 활성화 된 상태에서 사용자를 로그인 페이지로 보냅니다. 세션 시간이 초과 될 때 앱이 제공하는 동작처럼 보일 수 있습니다.
<system.web>
<authentication mode="Forms">
<forms timeout="50"/>
</authentication>
<sessionState timeout="60" />
</system.web>
양식 시간 초과를 세션 시간 초과보다 적은 것으로 설정하면 세션 데이터를 잃지 않고 다시 로그인 할 수있는 창이 사용자에게 제공 될 수 있습니다.
web.config 파일에서 다음 코드 블록을 사용하십시오. 여기서 기본 세션 시간 초과는 80 분입니다.
<system.web>
<sessionState mode="InProc" cookieless="false" timeout="80" />
</system.web>
팝업 경고 메시지와 함께 세션 시간 초과에 대해 다음 링크를 사용하십시오.
참고 : 위의 예제는 devexpress 팝업 컨트롤로 수행되므로 devexpress 팝업 컨트롤을 일반 팝업 컨트롤로 사용자 정의 / 교체해야합니다. devexpress를 사용하는 경우 사용자 정의 할 필요가 없습니다
web.config 또는 IIS에 대해 모르겠습니다. 하지만 C # 코드 에서처럼 할 수 있다고 생각합니다.
Session.Timeout = 60; // 60 is number of minutes
내 상황에서는 응용 프로그램 풀이었습니다. xx 분 동안 유휴 상태 일 때 다시 시작되도록 설정되어 있습니다. 다시 시작하지 않도록 설정하면 Web Config의 값을 사용하는 것 같습니다.
그것은 보통 당신이해야 할 모든 것입니다 ...
20 분 후에 세션이 유실 된 이유는 유휴 상태 인 것입니다.
세션이 지워지는 이유는 여러 가지가 있습니다. IIS에 대한 이벤트 로깅을 활성화 한 다음 이벤트 뷰어를 사용하여 세션이 지워진 이유를 확인할 수 있습니다. 다른 이유 일 수도 있습니다.
이벤트 메시지 및 관련 이벤트 테이블에 대한 설명서를 읽을 수도 있습니다 .
machine.config에 영향을 줄 수있는 것이 있습니까? web.config에서 세션 시간 초과를 설정하면 IIS 또는 machine.config의 설정이 재정의되지만 응용 프로그램의 하위 폴더에 web.config 파일이 있으면 해당 설정이 응용 프로그램의 루트에있는 설정보다 우선합니다.
또한 올바르게 기억하면 IIS의 시간 초과가 .aspx가 아닌 .asp 페이지에만 영향을 미칩니다. web.config의 세션 코드가 정확합니까? 다음과 같이 보일 것입니다 :
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
stateNetworkTimeout="60"
sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI"
cookieless="false"
timeout="60"
/>
인증을 사용하는 경우 web.config 파일에 다음을 추가하는 것이 좋습니다.
필자의 경우 사용자는 시간이 초과되면 로그인 페이지로 리디렉션됩니다.
<authentication mode="Forms">
<forms defaultUrl="Login.aspx" timeout="120"/>
</authentication>
https://usefulaspandcsharp.wordpress.com/tag/session-timeout/
<authentication mode="Forms">
<forms loginUrl="Login.aspx" name=".ASPXFORMSAUTH" timeout="60" slidingExpiration="true" />
</authentication>
<sessionState mode="InProc" timeout="60" />
IIS에서 설정을 찾을 수 있습니다.
서버 수준, 웹 사이트 수준 또는 "ASP"아래의 앱 수준에서 찾을 수 있습니다.
여기 web.config 수준에서 설정할 수 있다고 생각합니다. 직접 확인하시기 바랍니다.
<configuration>
<system.web>
<!-- Session Timeout in Minutes (Also in Global.asax) -->
<sessionState timeout="1440"/>
</system.web>
</configuration>
ASP.Net 코어 1.0 (vNext 또는 다른 이름이 사용됨) 세션은 다르게 구현됩니다. 에서 세션 시간 제한 값을 다음 Startup.cs과 같이 변경했습니다 void ConfigureServices.
services.AddSession(options => options.IdleTimeout = TimeSpan.FromSeconds(42));
Or if you want to use the appsettings.json file, you can do something like:
// Appsettings.json
"SessionOptions": {
"IdleTimeout": "00:30:00"
}
// Startup.cs
services.AddSession(options => options.IdleTimeout = TimeSpan.Parse(Config.GetSection("SessionOptions")["IdleTimeout"]));
IIS sessions timeout value is for classic .asp applications only, this is controlled on IIS configuration. In your case For ASP.NET apps, only the web.config-specified timeout value applies.
if you are want session timeout for website than remove
<authentication mode="Forms">
<forms timeout="50"/>
</authentication>
tag from web.config file.
The Timeout property specifies the time-out period assigned to the Session object for the application, in minutes. If the user does not refresh or request a page within the time-out period, the session ends.
IIS 6.0: The minimum allowed value is 1 minute and the maximum is 1440 minutes.
Session.Timeout = 600;
After changing the session timeout value in IIS, Kindly restart the IIS. To achieve this go to command prompt. Type IISRESET and press enter.
참고URL : https://stackoverflow.com/questions/648992/session-timeout-in-asp-net
'Programming' 카테고리의 다른 글
| 직접 대 위임-jQuery .on () (0) | 2020.06.05 |
|---|---|
| Xcode 디버거는 객체를 인쇄하지 않고 nil을 표시합니다. (0) | 2020.06.05 |
| 더 이상 존재하지 않는 원격 분기를 표시하는 'git branch -av' (0) | 2020.06.05 |
| 메모장에서 개행 문자를 선택하십시오 ++ (0) | 2020.06.04 |
| 파이썬에서이 긴 줄을 어떻게 나눌 수 있습니까? (0) | 2020.06.04 |
