Click here to Skip to main content
11,927,711 members (36,733 online)
Rate this:
Please Sign up or sign in to vote.
See more: IIS7 C# ASP.NET IIS C#4.0
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 1:22am
Edited 4-Oct-12 4: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 | Mobile
Web01 | 2.8.151126.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2015
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