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

Browse Folder

P: n/a
Framework: Visual Studio 2005
Technology: ASP.NET 2.0
Language: C#.NET 2.0

I am trying to browse folders through the following piece of code.
Please let me know if there is any kind of setting to get this working
right?

using shell32.dll;
Shell32.ShellClass shl = new Shell32.ShellClass();
Shell32.Folder2 fld = (Shell32.Folder2)shl.BrowseForFolder(0, "Show Folder",
0, System.Reflection.Missing.Value);
txtFolderName.Text = fld.Self.Path ;

Kindly advice

Kuldeep


Jul 3 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Are the folders you want to browse on client or server side? Your code is
apparently for server side.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Kuldeep" <ku****************@hotmail.comwrote in message
news:On**************@TK2MSFTNGP05.phx.gbl...
Framework: Visual Studio 2005
Technology: ASP.NET 2.0
Language: C#.NET 2.0

I am trying to browse folders through the following piece of code.
Please let me know if there is any kind of setting to get this working
right?

using shell32.dll;
Shell32.ShellClass shl = new Shell32.ShellClass();
Shell32.Folder2 fld = (Shell32.Folder2)shl.BrowseForFolder(0, "Show
Folder", 0, System.Reflection.Missing.Value);
txtFolderName.Text = fld.Self.Path ;

Kindly advice

Kuldeep


Jul 3 '07 #2

P: n/a
yes it is on the server side.
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:eS**************@TK2MSFTNGP05.phx.gbl...
Are the folders you want to browse on client or server side? Your code is
apparently for server side.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Kuldeep" <ku****************@hotmail.comwrote in message
news:On**************@TK2MSFTNGP05.phx.gbl...
>Framework: Visual Studio 2005
Technology: ASP.NET 2.0
Language: C#.NET 2.0

I am trying to browse folders through the following piece of code.
Please let me know if there is any kind of setting to get this working
right?

using shell32.dll;
Shell32.ShellClass shl = new Shell32.ShellClass();
Shell32.Folder2 fld = (Shell32.Folder2)shl.BrowseForFolder(0, "Show
Folder", 0, System.Reflection.Missing.Value);
txtFolderName.Text = fld.Self.Path ;

Kindly advice

Kuldeep



Jul 3 '07 #3

P: n/a
On Jul 3, 2:53 pm, "Kuldeep" <kuldeep.vijayku...@hotmail.comwrote:
yes it is on the server side.

"Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote in
messagenews:eS**************@TK2MSFTNGP05.phx.gbl. ..
Are the folders you want to browse on client or server side? Your code is
apparently for server side.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Kuldeep" <kuldeep.vijayku...@hotmail.comwrote in message
news:On**************@TK2MSFTNGP05.phx.gbl...
Framework: Visual Studio 2005
Technology: ASP.NET 2.0
Language: C#.NET 2.0
I am trying to browse folders through the following piece of code.
Please let me know if there is any kind of setting to get this working
right?
using shell32.dll;
Shell32.ShellClass shl = new Shell32.ShellClass();
Shell32.Folder2 fld = (Shell32.Folder2)shl.BrowseForFolder(0, "Show
Folder", 0, System.Reflection.Missing.Value);
txtFolderName.Text = fld.Self.Path ;
Kindly advice
Kuldeep- Hide quoted text -

- Show quoted text -
Shell32 is for "local usage"

Use System.IO

the code would be something like this

foreach (string s in Directory.GetFiles(Server.MapPath("/"), "*.*")
{
.....
}

Jul 3 '07 #4

P: n/a
"Kuldeep" <ku****************@hotmail.comwrote in message
news:um**************@TK2MSFTNGP04.phx.gbl...
>I am trying to browse folders through the following piece of code.
Please let me know if there is any kind of setting to get this working
right?

using shell32.dll;
Shell32.ShellClass shl = new Shell32.ShellClass();
Shell32.Folder2 fld = (Shell32.Folder2)shl.BrowseForFolder(0, "Show
Folder", 0, System.Reflection.Missing.Value);
txtFolderName.Text = fld.Self.Path ;
yes it is on the server side.
You need to stop for a second and take one step back...

What does BrowseForFolder actually do?

Well, according to MSDN
(http://msdn2.microsoft.com/en-us/library/ms630408.aspx) it "creates a
dialog box that enables the user to select a folder and then returns the
selected folder's Folder object."

That's fine, of course, for WinForms apps and client-side web functionality
(well, not really, but we'll let that pass...)

However, you're trying to run this server-side... Even if you do manage to
call the BrowserForFolder method, and even supposing it worked, who's
actually going to see the dialog box and select a folder?

What are you actually trying to do here? Presumably, a user visits one of
your pages and clicks a button (or something), and then needs to select a
folder for some reason...?

Where are these folders located? Does the account that ASP.NET is running
under even have permissions to to what you're trying to do...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 3 '07 #5

P: n/a
Hi Mark,

I have a same requirement, I'm developing ASP.net application in C#,
framework 2.0 where I need to display a browse folder at client side. please
let me know how i can implement this web forms.

I have implemented a javascript code given in the url by you, but it is now
working and giving a javascript error "Permissions denied"

Ashish Khanna

"Mark Rae" wrote:
"Kuldeep" <ku****************@hotmail.comwrote in message
news:um**************@TK2MSFTNGP04.phx.gbl...
I am trying to browse folders through the following piece of code.
Please let me know if there is any kind of setting to get this working
right?

using shell32.dll;
Shell32.ShellClass shl = new Shell32.ShellClass();
Shell32.Folder2 fld = (Shell32.Folder2)shl.BrowseForFolder(0, "Show
Folder", 0, System.Reflection.Missing.Value);
txtFolderName.Text = fld.Self.Path ;
yes it is on the server side.

You need to stop for a second and take one step back...

What does BrowseForFolder actually do?

Well, according to MSDN
(http://msdn2.microsoft.com/en-us/library/ms630408.aspx) it "creates a
dialog box that enables the user to select a folder and then returns the
selected folder's Folder object."

That's fine, of course, for WinForms apps and client-side web functionality
(well, not really, but we'll let that pass...)

However, you're trying to run this server-side... Even if you do manage to
call the BrowserForFolder method, and even supposing it worked, who's
actually going to see the dialog box and select a folder?

What are you actually trying to do here? Presumably, a user visits one of
your pages and clicks a button (or something), and then needs to select a
folder for some reason...?

Where are these folders located? Does the account that ASP.NET is running
under even have permissions to to what you're trying to do...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 6 '07 #6

P: n/a
"Ashish Khanna" <As**********@discussions.microsoft.comwrote in message
news:CA**********************************@microsof t.com...
I have a same requirement, I'm developing ASP.net application in C#,
framework 2.0 where I need to display a browse folder at client side.
That's not, actually, the same requirement - the OP was trying to use
client-side code to browse for folders server-side...
please let me know how i can implement this web forms.
I have implemented a javascript code given in the url by you, but it is
now
working and giving a javascript error "Permissions denied"
Slightly confused - you say "it is now working and giving a javascript
error" - it can't both be working *and* giving a javascript error... :-)

Please show your code.

Alternatively, have a look at this:
http://www.utechsoft.com/products/ud...emo/index.html
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 6 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.