会话值丢失 [英] Session values are lost

查看:63
本文介绍了会话值丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





在我的应用程序中,我打开文档文件并将该文件转换为HTML文件。它的工作正常,但执行此操作时会话中的值丢失,请您帮我解决此问题。我没有给出任何回应。重定向方法。当动作成功执行动作时,我只是绑定网格。这是我的代码。



Hi,

In my Application I am opening the Document file and Converting that file to a HTML file. Its working fine but the values in the Session is lost when this action is performed can u please help me to solve this issue. I have not given any Response. Redirect method. I am just binding the Grid when the action is action is performed successfully. Here is my code.

public void Upload()
   {
       object missingType = Type.Missing;
       object readOnly = true;
       object isVisible = false;
       object documentFormat = 8;
       object htmlFilePath = Server.MapPath("~/HelpFolder/HTML Files/") + hdFileName.Value + ".htm";
       //string directoryPath = Server.MapPath("~/HelpFolder/HTML Files/") + hdFileName.Value + "_files";
       ////Upload the word document and save to Temp folder
       object fileName = Server.MapPath("~/HelpFolder/Doc Files/")+hdFileName.Value+ ".Docx";
       //Open the word document in background
       Microsoft.Office.Interop.Word.ApplicationClass applicationclass = new Microsoft.Office.Interop.Word.ApplicationClass();
       applicationclass.Documents.Open(ref fileName,
                                       ref readOnly,
                                       ref missingType, ref missingType, ref missingType,
                                       ref missingType, ref missingType, ref missingType,
                                       ref missingType, ref missingType, ref isVisible,
                                       ref missingType, ref missingType, ref missingType,
                                       ref missingType, ref missingType);
       applicationclass.Visible = false;
       Microsoft.Office.Interop.Word.Document document = applicationclass.ActiveDocument;
       //Save the word document as HTML file
       document.SaveAs(ref htmlFilePath, ref documentFormat, ref missingType,
                       ref missingType, ref missingType, ref missingType,
                       ref missingType, ref missingType, ref missingType,
                       ref missingType, ref missingType, ref missingType,
                       ref missingType, ref missingType, ref missingType,
                       ref missingType);
       //Close the word document
       //document.Close(ref missingType, ref missingType, ref missingType);
       ((Microsoft.Office.Interop.Word._Document)document).Close(ref missingType, ref missingType, ref missingType);
       ((Microsoft.Office.Interop.Word._Application)applicationclass).Quit(ref missingType, ref missingType, ref missingType);

   }





谢谢



Thanks

推荐答案

Use timeout in web.config, can also use timespan--20 minutes is default, also The timeout attribute cannot be set to a value that is greater than 525,601 minutes (1 year) for the in-process and state-server modes.

<sessionstate>
    mode="[Off|InProc|StateServer|SQLServer|Custom]"
    timeout="number of minutes"............

   ....../></sessionstate>





msdn

解决过期的ASP.NET会话状态和选项


这篇关于会话值丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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