ASP.NET - 基于的sessionState超时在web.config中的Javascript超时警告 [英] ASP.NET - Javascript timeOut Warning based on sessionState timeOut in web.config
本文介绍了ASP.NET - 基于的sessionState超时在web.config中的Javascript超时警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问题:我期待与基于背后把我的webconfig的sessionState timeout属性是C#code一个asp.net页面上创建一个超时警告消息。
在web.config中code:
<结构>
<&的System.Web GT;
<的sessionState超时=20>< /&的sessionState GT;
< /system.web>
< /结构>
< system.serviceModel>
<&绑定GT;
<&basicHttpBinding的GT;
<绑定名称=EchoSignDocumentService10HttpBindingcloseTimeout =0时01分00秒openTimeout =0时01分00秒receiveTimeout =0点10分00秒的SendTimeout =0时01分00秒allowCookies =false的bypassProxyOnLocal =假hostNameComparisonMode =StrongWildcardMAXBUFFERSIZE =6553600maxBufferPoolSize =524288maxReceivedMessageSize =6553600messageEncoding =文本textEncoding =UTF-8transferMode =缓冲useDefaultWebProxy =真>
< readerQuotas MAXDEPTH =32maxStringContentLength =8192maxArrayLength =1638400maxBytesPerRead =4096maxNameTableCharCount =16384/>
<安全模式=运输>
<运输clientCredentialType =无proxyCredentialType =无的境界=/>
<消息clientCredentialType =用户名algorithmSuite =默认/>
< /安全>
< /&结合GT;
<绑定名称=EchoSignDocumentService10HttpBinding1closeTimeout =0时01分00秒openTimeout =0时01分00秒receiveTimeout =○点10分00秒的SendTimeout =0时01分00秒allowCookies =false的bypassProxyOnLocal =假hostNameComparisonMode =StrongWildcardMAXBUFFERSIZE =65536maxBufferPoolSize =524288maxReceivedMessageSize =65536messageEncoding =文本textEncoding =UTF-8transferMode =缓冲useDefaultWebProxy =真>
< readerQuotas MAXDEPTH =32maxStringContentLength =8192maxArrayLength =16384maxBytesPerRead =4096maxNameTableCharCount =16384/>
<安全模式=无>
<运输clientCredentialType =无proxyCredentialType =无的境界=/>
<消息clientCredentialType =用户名algorithmSuite =默认/>
< /安全>
< /&结合GT;
< / basicHttpBinding的>
< /绑定>
< /system.serviceModel>
解决方案
我是不是能够得到FishbasketGordo的code的工作,因为Web方法调用保存传递布尔值假作为方法的onSuccess。大量的研究后,我做了以下修改。
$(函数(){
VAR isTimeout = FALSE;
VAR回调=功能(isTimeout){
如果(isTimeout){
//此处显示弹出窗口...
警报(你已超时);
}
}; VAR失败=功能(){
警报(问题与服务器);
}; 的setInterval(
功能(){
//不要忘记你的ScriptManager设置的EnablePageMethods =真。
PageMethods.HasSessionTimedOut(回调,失败);
},30000
);
});
Problem: I am looking to create a time-out warning message on an asp.net page with a c# code behind based off my webconfig sessionState TimeOut Attribute.
Code on web.config:
<configuration>
<system.web>
<sessionState timeout="20"></sessionState>
</system.web>
</configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="EchoSignDocumentService10HttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="1638400" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="EchoSignDocumentService10HttpBinding1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
解决方案
I was not able to get FishbasketGordo's code to work because the Web Method call kept passing the Boolean value "false" as the onsuccess method. After much research I made the following changes.
$(function () {
var isTimeout = false;
var callback = function (isTimeout) {
if (isTimeout) {
// Show your pop-up here...
alert("You have timed out");
}
};
var failure = function () {
alert("Problem with Server");
};
setInterval(
function () {
// Don't forget to set EnablePageMethods="true" on your ScriptManager.
PageMethods.HasSessionTimedOut(callback,failure);
}, 30000
);
});
这篇关于ASP.NET - 基于的sessionState超时在web.config中的Javascript超时警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文