如何在 Asp.Net 中单击 Jquery UI 选项卡来关闭会话
我想知道如何在 asp.net 中单击 Jquery UI 选项卡来关闭会话。
实际上,我正在处理上传图像,当用户上传时,我将它们保存在具有生成的随机字符串值的文件夹下。
因此,我需要通过单击选项卡来关闭会话,因为当用户刷新并尝试上传时遇到问题,因为会话未清除,我收到错误。
这是我的 Javascript 代码:
<script type="text/javascript">
// Convert divs to queue widgets when the DOM is ready
$(function () {
var tempDir = randomString(8);
document.getElementById("currentDirectory").value = tempDir;
$("#uploader").plupload({
// General settings
runtimes: 'gears,flash,silverlight,browserplus,html5',
url: 'upload.aspx?xyz=' + tempDir,
max_file_size: '10mb',
max_file_count: 10,
chunk_size: '1mb',
unique_names: true
});
</script>
这是 Jquery UI 选项卡代码:
<div id="tabs">
<ul>
<li><a href="#tabs-1">
<li><a href="#tabs-2">
<li><a href="#tabs-3">
</ul>
<div id="tabs-1">
</div>
<div id="tabs-2">
</div>
<div id="tabs-3">
</div>
</div>
I would like to know how to close session with a Jquery UI tab click in asp.net.
Actually I am working with upload Images and when user upload I am saving them under a folder with genrated random string value.
So I need to close the session with a tab click as I am having problem when the user refreshes and tries to upload I'm getting error as the session is not clearing.
Here is my Javascript code:
<script type="text/javascript">
// Convert divs to queue widgets when the DOM is ready
$(function () {
var tempDir = randomString(8);
document.getElementById("currentDirectory").value = tempDir;
$("#uploader").plupload({
// General settings
runtimes: 'gears,flash,silverlight,browserplus,html5',
url: 'upload.aspx?xyz=' + tempDir,
max_file_size: '10mb',
max_file_count: 10,
chunk_size: '1mb',
unique_names: true
});
</script>
Here is the Jquery UI tab code:
<div id="tabs">
<ul>
<li><a href="#tabs-1">
<li><a href="#tabs-2">
<li><a href="#tabs-3">
</ul>
<div id="tabs-1">
</div>
<div id="tabs-2">
</div>
<div id="tabs-3">
</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用 *IRequiresSessionState * 接口对 ASHX 文件进行 ajax 调用
在那里你应该使用会话放弃。
you should have an ajax call to an ASHX file with *IRequiresSessionState * Interface
and there you should use the session abandon.