Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: IIS7ASP.NETC#4.0
Hi All,
 
In my asp.net 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;
 
            try
            {
                Thread objThread = new Thread(state =>{
                    result = FnOpenFileDialog();
                    // TODO: do something with the returned result
                });
 
                objThread.IsBackground = false;
                objThread.SetApartmentState(ApartmentState.STA);
                objThread.Start();
                objThread.Join();
                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
Edited 4-Oct-12 3:23am
v3
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
Try to set cookies in your browser and assign values from cookies to session.
 
Hope this will help you.
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 576
1 OriginalGriff 183
2 Sergey Alexandrovich Kryukov 156
3 Tadit Dash 150
4 Peter Leow 140
0 Sergey Alexandrovich Kryukov 9,280
1 OriginalGriff 5,473
2 Peter Leow 4,100
3 Maciej Los 3,540
4 Abhinav S 3,333


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid