Question about embedded winform controls

  • Thread starter A Lonely Programmer
  • Start date
A

A Lonely Programmer

Hi group,

Consider the following code:

Dim dirinfo As New DirectoryInfo("c:\test")

Dim fileinfo() As FileInfo = dirinfo.GetFiles

Dim fi As FileInfo

For Each fi In fileinfo

TreeView2.Nodes.Add(fi.Name)

Next





If instead of adding nodes to a treeview, i throw in a response.write the following works perfectly fine in an aspx page. However, the same code in an embedded windows control causes the component to not load.

everything else in the component will load if i take that out and throw in random values. I suspect this is a security issue but the fact that it works in an aspx page is throwing me off. Currently i am putting the dll into the directory of the page, will it make any difference if i add it to the GAC? I am so close to something really beautiful. any insight would be appreciated.



Thanks



Steve
 
K

Kristof Van Praet

You cannot acces the local filesystem from an embedded windows user control.
That is a security issue. Downloaded assemblies are placed in the download
cache and from there, they cannot access local resources (file system, db,
printer,...).

You can change the security policy for the assembly that you download. This
can be done in the Microsoft .NET Framework 1.1 Configuration console or the
Microsoft .NET Framework 1.1 Wizards. These can be found in the Administrive
tools window. There you can trust the assembly you want to use in the
browser. Not that this has to be done for every client machine that uses
this control.

I don't know if this was the answer you were looking for.
Regards.
Kristof




Hi group,

Consider the following code:

Dim dirinfo As New DirectoryInfo("c:\test")
Dim fileinfo() As FileInfo = dirinfo.GetFiles
Dim fi As FileInfo
For Each fi In fileinfo
TreeView2.Nodes.Add(fi.Name)
Next


If instead of adding nodes to a treeview, i throw in a response.write the
following works perfectly fine in an aspx page. However, the same code in an
embedded windows control causes the component to not load.
everything else in the component will load if i take that out and throw in
random values. I suspect this is a security issue but the fact that it works
in an aspx page is throwing me off. Currently i am putting the dll into the
directory of the page, will it make any difference if i add it to the GAC? I
am so close to something really beautiful. any insight would be appreciated.

Thanks

Steve
 
R

Raterus

perhaps this will help you fill that treeview of yours, it worked great for
me. There should be a vb sample you can download.

http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=109

Hi group,

Consider the following code:

Dim dirinfo As New DirectoryInfo("c:\test")
Dim fileinfo() As FileInfo = dirinfo.GetFiles
Dim fi As FileInfo
For Each fi In fileinfo
TreeView2.Nodes.Add(fi.Name)
Next


If instead of adding nodes to a treeview, i throw in a response.write the
following works perfectly fine in an aspx page. However, the same code in an
embedded windows control causes the component to not load.
everything else in the component will load if i take that out and throw in
random values. I suspect this is a security issue but the fact that it works
in an aspx page is throwing me off. Currently i am putting the dll into the
directory of the page, will it make any difference if i add it to the GAC? I
am so close to something really beautiful. any insight would be appreciated.

Thanks

Steve
 
A

A Lonely Programmer

Kristof,

Thanks, this is exactly the answer i was looking for. What if, let's say, a
user didn't go to 2003 (because whidbey was all ready on the horizon and is
promising to not rewrite my code) and is still using the original. Is there
work arounds that do the same thing for 1.0?

thanks a ton for your time

Steve
 
A

A Lonely Programmer

Thanks for taking the time to response Raterus. I knew about the ie controls
but they won't work for me. I am trying to develop an embedded ftp program
and postbacks are the devil (because i have to reconnect after every
postback). Even though this wasn't what i needed, i appreciate you taking
the time to answer my question.

thanks

steve
 

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

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,610
Members
45,254
Latest member
Top Crypto TwitterChannel

Latest Threads

Top