Click here to Skip to main content
13,556,387 members
Rate this:
Please Sign up or sign in to vote.
Hi All,

In my application, iam using windows forms.dll to use some of the windows controls by creating a thread.This works fine in my system but is giving a session timeout when hosted on IIS.
Creating a thread gives me session time out on IIS.
How do i create threads that can work fine on IIS?

Below is the code where iam created the thread.

public string[] DisplayFileDialog()
            string[] result = null;

                Thread objThread = new Thread(state =>{
                    result = FnOpenFileDialog();
                    // TODO: do something with the returned result

                objThread.IsBackground = false;
                return result;

            catch (Exception ex)

                return result;

     protected string[] FnOpenFileDialog()
            IntPtr hdlr = GetForegroundWindow();

            WindowWrapper Mockwindow = new WindowWrapper(hdlr);

            OpenFileDialog fDialog = new OpenFileDialog();

            fDialog.Title = "Select Files";

            fDialog.Multiselect = true;
            fDialog.CheckFileExists = true;
            fDialog.CheckPathExists = true;

            System.Windows.Forms.DialogResult dr = fDialog.ShowDialog(Mockwindow);
            string[] filenames = fDialog.FileNames;
            return filenames;

Thanks in advance.
Posted 4-Oct-12 0:22am
Updated 4-Oct-12 3:23am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


Try to set cookies in your browser and assign values from cookies to session.

Hope this will help you.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hi ,

That was because my server is of 64 bit and windows forms handler window was of 32 bit.
I cannot use a windows forms object on the server.
I used flajaxian uploader to solve my problem.This allows me to select multiple files even in IE 7.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.180515.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100