Dragdrop with NTD

L

Laurent Chevallier

Hi,

I've developped a windows form application in C# that uses drag and drop.
This application works fine when I execute it locally directly from the PC
on which it has been installed.
Now I'm testing the execution of this application by using NTD (i.e. launch
the exe file from an URL, all the needed files will then be downloaded on
the client computer in a temporary forlder for furhter execution...).
But it doesn't work! An error message is displayed "DragDrop registration
failed". I've tried a lot of things but unsuccessfully.
My Main method has the STAThread attribute.
If I suppress all the drag and drop functionnalities the application works
fin with NTD.
I'm wondering then the interest of the NTD technology.... unless someone can
help me in solving this blocking problem.

Thanks in advance.
 
B

Bharat Patel [MSFT]

Hi Laurent,

Try setting the STA on the application.Run line too as follows:

The attribute itself does not work correctly due to a known issue.


[STAThread]
static void Main()
{
System.Threading.Thread.CurrentThread.ApartmentState =
System.Threading.ApartmentState.STA;
Application.Run(new Form1());

}

Also make sure to adjust appropriate Code Access Security permissions.
Any code which runs from an Intranet or Intenet zone runs in partially trusted
zone.
It may work without tweaking caspol if your application does not access any
restricted resources on the local machine.


Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 
L

Laurent Chevallier

Hi Bharat,

First, thank you for your answer.
Unfortunately, I've already added the [STAThread] attribute and the line
System.Threading.Thread.CurrentThread.ApartmentState =
System.Threading.ApartmentState.STA; but the result is the same (I've
already looked at most of MS KB (Technet, MSDN, Premier Online) and at a lot
of newsgroup).
Moreover, the assembly has been declared as a full trust assembly (in order
to avoid security problem, restriction will then be applied once it will
work fine).
The problem appears when a control of my form has the propriety Allowdrop
set to true.
I've tried to bypass the security (I'm administrator, the web server is on
the same PC, and the IIS virual directory doesn't allow anonymous
connection...) but always the same "Dragdrop registration failed".
I wonder if this should work or does NTD only works with forms that does not
use Drag and Drop features (like web app...).
Can you tell me more, please.

Best regards.
 
B

Bharat Patel [MSFT]

Hi Laurent,

Make sure to set the Apartment state in your Sub Main as the first line.
This is the only known issue which causes the problem you have. So if this does
not resolve your issue, please open a support call with our Internet Explorer
team to repor this issue.

Also try to clear download cache and run it again.

gacutil /cdl


Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top