473,378 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 6437
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.