mikesowerbutts 0 Newbie Poster

Hi,

I have some code which creates a PDF based on the data posted to the entry point page (print.aspx).

When I run a page with multiple frames in, each accessing the main print.aspx and posting data etc. but for some reason each frame loads one at a time, rather than all frames loading at once (or atleast roughly at once). this web app is used by quite a few thousand users and ideally two or more users should be able to print concurrently, rather than getting the queueing which seems to be happening at the moment.

Ive been programming c# for a while, but im a bit of a newbie with ASP.NET and IIS. I heard that IIS will automatically run the code in multiple threads if there are multiple people accessing it concurrently? Is this the case, or do i need to manually create a new thread in the Page_Load() event handler and then create a new instance of my print object from there.

I have tried this:

protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                ThreadStart _ts = new ThreadStart(init);
                Thread _thr = new Thread(_ts);
                _thr.Start();
            }
            catch(Exception ex)
            {
                Response.Write("ERROR - PAGELOAD - " + ex.Message);
            }
        }
private void init()
        {
            GetQueryString();
            if (__XmlData != null)
            {
                __GUID = Utils.GenGUID();
                __PrintHandler = new PrintHandler(__GUID, __XmlData, true);
                __PrintHandler.ResetAll();
                SaveBrowserPDF(CommonData.Instance.GetByID(__GUID).PdfDocument);
            }
        }

but it either errors, or the frames in my test page are just blank...

I didnt include all the functions, but hopefully you can get the picture.

Do I even need to worry about threading, or with .NET/IIS do it for me automatically?

One more thing to note is that I have a singleton class called CommonData, which holds a List<PdfObjects>() object for each instance I create a new GUID in the init() function, then each object can reference CommonData.Instance.GetByID(__GUID) which retrns one of the PdfObjects, so i can do myPdgObject.MyImportantObject in places which know the GUID, but dont have a reference to the object in question. I dont think this should be a problem, but i thought i would mention it just in case...

Thanks,

Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.