472,952 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,952 software developers and data experts.

Browse Folder

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
6 6418
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
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
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
"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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: deko | last post by:
I'm using the below code to allow users to browse for and select a folder. After selecting a folder from the dialog, the full path is returned to a text box and saved. The next time the user...
8
by: Salad | last post by:
I designed a small app and I wanted to do a BrowseFolder (see http://www.mvps.org/access/api/api0002.htm), basically do a file open diaglog and select a directory/folder. The problem is that you...
1
by: Joshua Ellul | last post by:
Hi There, Is there an existing browse folder component in the .net framework? Josh
9
by: Nick 'The Database Guy' | last post by:
Hi All, I want to browse to a particular folder, not a particular file. The reason for this is that I have a utility that asks people to browse to a certain file, and I want them to be able to...
4
by: rdemyan | last post by:
I'm using code from the following web page to open the API Browse Folder dialog http://www.mvps.org/access/api/api0002.htm It all works fine. But if the dialog box is open and the user closes...
7
by: rayken15 | last post by:
I'm working to add a simple GUI form to an already existing perl script. The script simply takes a part number and an output path. It then connects to a client application and downloads data to the...
1
by: =?Utf-8?B?SmF5LXBt?= | last post by:
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 =...
0
by: ms skhalid | last post by:
i m connected on LAN with another pc now i want to browse a folder on that pc. how can i do this? i have used folderbrowsedialog but i can only browse folders in my own pc. also it displays the...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.