By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,866 Members | 1,704 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,866 IT Pros & Developers. It's quick & easy.

Question about embedded winform controls

P: n/a
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

Nov 18 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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


"A Lonely Programmer" <Sp************@NoSpamForMe.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
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
Nov 18 '05 #2

P: n/a
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/Article...?articleID=109

"A Lonely Programmer" <Sp************@NoSpamForMe.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
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
Nov 18 '05 #3

P: n/a
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

"Kristof Van Praet" <kr**************@hotmail.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
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


"A Lonely Programmer" <Sp************@NoSpamForMe.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
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

Nov 18 '05 #4

P: n/a
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
"Raterus" <raterus@localhost> wrote in message
news:Ou**************@TK2MSFTNGP11.phx.gbl...
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/Article...?articleID=109

"A Lonely Programmer" <Sp************@NoSpamForMe.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
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

Nov 18 '05 #5

P: n/a
Never mind i see i have the same options for 1.0

thanks again kristof
"A Lonely Programmer" <Sp************@NoSpamForMe.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...
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

"Kristof Van Praet" <kr**************@hotmail.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
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


"A Lonely Programmer" <Sp************@NoSpamForMe.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
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


Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.