This project has moved. For the latest updates, please go here.

Handling multiple users

Dec 24, 2013 at 10:50 AM
Hi all,
I'm using Novacode Docx dll to create a word file of different Investor Master data using asp.net 3.5. After generating file I'm opening this file using word DCOM to add page borders and TOC and then exporting file to .DOC/.DOCX/.PDF depending upon user selection. My code is working perfect for single user. But two or more user try to generate the files (for different investors) one of the user's file generation process stops without generating any file and the file generated for the other user contains data of both the investors(investor selected by first user and investor selected by second user). Thus the file generated is wrong. I am not able to figure out what I have done wrong.
the code I've written is as mentioned below.


Public Shared document As DocX
Dim strReportPath As String


If Request.QueryString("Type") = 1 Then
                rptName = "WORDFinancialplanner" & Session("Inv_Code") & "_" & Session("Plan_Id") & ".docx"
                strReportPath = "D:\FP\UI\REPORTS\TEMP\WORDFinancialplanner" & Session("Inv_Code") & "_" & Session("Plan_Id") & ".docx"
            ElseIf Request.QueryString("Type") = 2 Then
                rptName = "WORDFinancialplanner" & Session("Inv_Code") & "_" & Session("Plan_Id") & ".docx"
                strReportPath = "D:\FP\UI\REPORTS\TEMP\WORDFinancialplanner" & Session("Inv_Code") & "_" & Session("Plan_Id") & ".docx"
            ElseIf Request.QueryString("Type") = 3 Then
                rptName = "WORDFinancialplanner" & Session("Inv_Code") & "_" & Session("Plan_Id") & ".docx"
                strReportPath = "D:\FP\UI\REPORTS\TEMP\WORDFinancialplanner" & Session("Inv_Code") & "_" & Session("Plan_Id") & ".docx"
            End If

document = DocX.Create(strReportPath)

document.PageWidth = 13000

document.InsertParagraph("")
<Some code for adding investor data here>

document.Save()

After this I open this saved document using DCOM for adding TOC and Pageborders. Then the file is downloaded at client end.
Request you to please guide me to resolve my problem.

Thanks & regards,
Santosh Kashid