multithreading - C# Thread to open OpenFileDialog is woking in VS 2005 development But not in IIS 6 -
below code used initial method
protected void gvexperience_rowcommand(object sender, gridviewcommandeventargs e) { switch (e.commandname) { case ("singleclick"): system.security.principal.windowsidentity identity = system.security.principal.windowsidentity.getcurrent(); gridviewrow gvr = (gridviewrow)((ctlbutton)e.commandsource).namingcontainer; int rowindex = gvr.rowindex; filethread = new thread(delegate() { openfile(rowindex, identity); }); filethread.apartmentstate = apartmentstate.sta; filethread.start(); filethread.join(); break; } }
second method called initial method
public void openfile(object row, object stateinfo) { system.security.principal.windowsidentity identity = stateinfo windowsidentity; identity.impersonate(); openfiledialog openfiledialog1 = new openfiledialog(); dialogresult result = openfiledialog1.showdialog(); int rowval = int.parse ( row.tostring()); if (result == dialogresult.ok) // test result. { ctllabel lbledit = (ctllabel)gvexperience.rows[rowval].cells[9].findcontrol("edttxtdocument"); lbledit.text = openfiledialog1.filename; filethread.abort(); } }
Comments
Post a Comment