471,330 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

How to access a IIS Web Site's folder from C#

Hi all,

I've created a IIS Web Site from c# and now I want to make two of its
folders unreadable.

How do I do?

I've tried a lot of code posted on the internet but with no luck.

Any help will me appreciated.

Many Thanks,

Brian
Sep 12 '08 #1
4 1200
Read these...
http://msdn.microsoft.com/en-us/libr...w7(VS.80).aspx
http://msdn.microsoft.com/en-us/library/ms178692.aspx


"Brian Roisentul" <ro*************@gmail.comwrote in message
news:5e**********************************@8g2000hs e.googlegroups.com...
Hi all,

I've created a IIS Web Site from c# and now I want to make two of its
folders unreadable.

How do I do?

I've tried a lot of code posted on the internet but with no luck.

Any help will me appreciated.

Many Thanks,

Brian
Sep 12 '08 #2
Hillbilly,

Thanks for your answer, but I think I didn't express myself correctly.

What I want to do is to have an unreadable folder within an IIS
(Internet Information Services) Web Site programmatically.

So far, I'm able to create an IIS Web Site from C# using
System.DirectoryServices library, but I'm not able to access its
folders' permissions, to make some of them unreadable.

Do you understand my point?

Many Thanks,

Brian
Sep 15 '08 #3
Hi All,

I've been investigating a while and i figured out something pretty
weird:

I downloaded a source code that allows me to do what I want. However,
it's written in asp.net v1.0 and I needed in v2.0. So, I converted it
to that version.

Well, you all can imagine it must have worked, but you're wrong: it
didn't (i'm pretty sure is that because i tried: copying the
procedures and functions I needed to a asp.net v2.0 project. Then,
after the last try didn't work, I tried converting the entire solution
to v2.0 and it did it successfully).

I don't know why, but the v1.0 application is able to create the entry
at the metabase under my virtual directory(IIS://localhost/W3SVC/<web
site id>/root/<new dir's name>) but when I try to do the same using
the v2.0 app i get the following error:

System.Runtime.InteropServices.COMException (0x80070003): The system
cannot find the path specified.

at System.DirectoryServices.DirectoryEntry.Bind(Boole an
throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObj ect()
at System.DirectoryServices.PropertyValueCollection.P opulateList()
at
System.DirectoryServices.PropertyValueCollection.. ctor(DirectoryEntry
entry, String propertyName)
at System.DirectoryServices.PropertyCollection.get_It em(String
propertyName)
at Example.Form1.setDirectory_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)

Do you have any clue on this?

Thanks,

Brian
Sep 17 '08 #4
In the end i think i have no option but using the Location and
Authorization tags within the web.config file of my application.

I'm testing it but it's not working.

Could you give me a hand on this, please?

Thanks,

Brian

On 12 sep, 15:10, "Hillbilly" <someb...@somewhere.comwrote:
Read these...http://msdn.microsoft.com/en-us/libr.../ms178692.aspx

"Brian Roisentul" <roisentul.br...@gmail.comwrote in message

news:5e**********************************@8g2000hs e.googlegroups.com...
Hi all,
I've created a IIS Web Site from c# and now I want to make two of its
folders unreadable.
How do I do?
I've tried a lot of code posted on the internet but with no luck.
Any help will me appreciated.
Many Thanks,
Brian
Sep 22 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Mark Lees | last post: by
5 posts views Thread by Andy P via AccessMonster.com | last post: by
2 posts views Thread by Ian B | last post: by
2 posts views Thread by Brandon | last post: by
2 posts views Thread by Chris Newby | last post: by
7 posts views Thread by Visitor No 3 | last post: by
9 posts views Thread by Wayne Smith | last post: by
7 posts views Thread by Agos | last post: by

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.