473,326 Members | 2,023 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,326 software developers and data experts.

AD in Web Application

MDS
All,

I want to retrieve Users from my AD via a Web appliction. I ran this script
to populate a combobox in a normal app and it works...
But when I use this script in a Web App it fails
Any Idea Why?

Marc
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE")

Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)

Dim result As System.DirectoryServices.SearchResult

Dim oValue As New ArrayList

Dim mySearcher

For Each result In mySearcher.FindAll()

oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry().Name,
Len(result.GetDirectoryEntry().Name) - 3))

Next

User1.DataSource = oValue

User1.Visible = True
Nov 20 '05 #1
12 1022

"MDS" <ab*@abc.com> wrote in message
news:eu**************@TK2MSFTNGP12.phx.gbl...
All,

I want to retrieve Users from my AD via a Web appliction. I ran this script to populate a combobox in a normal app and it works...
But when I use this script in a Web App it fails
Any Idea Why?

Marc
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE")

Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)

Dim result As System.DirectoryServices.SearchResult

Dim oValue As New ArrayList

Dim mySearcher

For Each result In mySearcher.FindAll()

should this by MySearcher1?
oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry().Name,
Len(result.GetDirectoryEntry().Name) - 3))

Next

User1.DataSource = oValue

User1.Visible = True

Nov 20 '05 #2
Cor
Hi MDS,

This kind of errors is mostly because the aspnet user has (fortunatly) no
rights on the server resources.

But it is a gues,

Cor
Nov 20 '05 #3
By default your web application will run under the machine account, which
has no network privledges. You could either specify a username and password
that has rights to access that LDAP root when you create "entry" (see the
overloads for the DirectoryEntry constructor to pass credentials), or - you
could use impersonation in your web app. (do this only if people hitting it
will be from an internal network, on your local domain).

To pass in credentials:
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE",
"userLogin", "Password")

To enable impersonation, in your web.config file, add this in the
<system.web> config section:
<identity impersonate="true"/>

(the impersonate key would also allow you to impersonate a specific user for
that web application. See the docs for more information on asp.net's
identity tag, or this kb article
http://support.microsoft.com/default.aspx?kbid=306158)

"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...

"MDS" <ab*@abc.com> wrote in message
news:eu**************@TK2MSFTNGP12.phx.gbl...
All,

I want to retrieve Users from my AD via a Web appliction. I ran this

script
to populate a combobox in a normal app and it works...
But when I use this script in a Web App it fails
Any Idea Why?

Marc
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE")

Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)

Dim result As System.DirectoryServices.SearchResult

Dim oValue As New ArrayList

Dim mySearcher

For Each result In mySearcher.FindAll()


should this by MySearcher1?
oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry().Name,
Len(result.GetDirectoryEntry().Name) - 3))

Next

User1.DataSource = oValue

User1.Visible = True


Nov 20 '05 #4
MDS
Your right...
Sorry...

"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...

"MDS" <ab*@abc.com> wrote in message
news:eu**************@TK2MSFTNGP12.phx.gbl...
All,

I want to retrieve Users from my AD via a Web appliction. I ran this

script
to populate a combobox in a normal app and it works...
But when I use this script in a Web App it fails
Any Idea Why?

Marc
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE")

Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)

Dim result As System.DirectoryServices.SearchResult

Dim oValue As New ArrayList

Dim mySearcher

For Each result In mySearcher.FindAll()


should this by MySearcher1?
oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry().Name,
Len(result.GetDirectoryEntry().Name) - 3))

Next

User1.DataSource = oValue

User1.Visible = True


Nov 20 '05 #5
MDS
Philip, Adding that gives me an error...
Also when I use LDAP://dc:prod,dc=telenet,dc=be" then it gives an error
while running. When I use "LDAP://"servername" it doesn't...Any Idea? I'm
very new to VB.net, but have a lot experience in VBS

Marc

"Philip Rieck" <st***@mckraken.com> wrote in message
news:e8**************@tk2msftngp13.phx.gbl...
By default your web application will run under the machine account, which
has no network privledges. You could either specify a username and password that has rights to access that LDAP root when you create "entry" (see the
overloads for the DirectoryEntry constructor to pass credentials), or - you could use impersonation in your web app. (do this only if people hitting it will be from an internal network, on your local domain).

To pass in credentials:
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE",
"userLogin", "Password")

To enable impersonation, in your web.config file, add this in the
<system.web> config section:
<identity impersonate="true"/>

(the impersonate key would also allow you to impersonate a specific user for that web application. See the docs for more information on asp.net's
identity tag, or this kb article
http://support.microsoft.com/default.aspx?kbid=306158)

"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...

"MDS" <ab*@abc.com> wrote in message
news:eu**************@TK2MSFTNGP12.phx.gbl...
All,

I want to retrieve Users from my AD via a Web appliction. I ran this

script
to populate a combobox in a normal app and it works...
But when I use this script in a Web App it fails
Any Idea Why?

Marc
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE")

Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)
Dim result As System.DirectoryServices.SearchResult

Dim oValue As New ArrayList

Dim mySearcher

For Each result In mySearcher.FindAll()


should this by MySearcher1?
oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry().Name, Len(result.GetDirectoryEntry().Name) - 3))

Next

User1.DataSource = oValue

User1.Visible = True



Nov 20 '05 #6
MDS
And how do we fix this?

"Cor" <no*@non.com> wrote in message
news:ev**************@tk2msftngp13.phx.gbl...
Hi MDS,

This kind of errors is mostly because the aspnet user has (fortunatly) no
rights on the server resources.

But it is a gues,

Cor

Nov 20 '05 #7
Cor
Hi,

You did get some answers I saw, but I never give answers accoording to
change the security downwards.

But there is a special newsgroup for this

microsoft.public.dotnet.security

Cor
And how do we fix this?

Nov 20 '05 #8
MDS
Thx Cor, Next time i'll post it there...but in the meantime...would you be
so kind to help me?

Marc
"Cor" <no*@non.com> wrote in message
news:Oy**************@TK2MSFTNGP10.phx.gbl...
Hi,

You did get some answers I saw, but I never give answers accoording to
change the security downwards.

But there is a special newsgroup for this

microsoft.public.dotnet.security

Cor
And how do we fix this?


Nov 20 '05 #9
What error does that give you ? (note that username and password should be a
user that has credentials to that LDAP directory - try your own if you can
get it to work locally)

Your first LDAP string should search the default domain, while the second
looks at a particular server. Unfortunately, I am not an LDAP guru, and
can't really help you on that. I have to flop about in order to get LDAP
strings right myself.

Did you try the impersonation avenue at all?
"MDS" <ab*@abc.com> wrote in message
news:eB**************@tk2msftngp13.phx.gbl...
Philip, Adding that gives me an error...
Also when I use LDAP://dc:prod,dc=telenet,dc=be" then it gives an error
while running. When I use "LDAP://"servername" it doesn't...Any Idea? I'm
very new to VB.net, but have a lot experience in VBS

Marc

"Philip Rieck" <st***@mckraken.com> wrote in message
news:e8**************@tk2msftngp13.phx.gbl...
By default your web application will run under the machine account, which
has no network privledges. You could either specify a username and

password
that has rights to access that LDAP root when you create "entry" (see the overloads for the DirectoryEntry constructor to pass credentials), or -

you
could use impersonation in your web app. (do this only if people hitting

it
will be from an internal network, on your local domain).

To pass in credentials:
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE",
"userLogin", "Password")

To enable impersonation, in your web.config file, add this in the
<system.web> config section:
<identity impersonate="true"/>

(the impersonate key would also allow you to impersonate a specific user

for
that web application. See the docs for more information on asp.net's
identity tag, or this kb article
http://support.microsoft.com/default.aspx?kbid=306158)

"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...

"MDS" <ab*@abc.com> wrote in message
news:eu**************@TK2MSFTNGP12.phx.gbl...
> All,
>
> I want to retrieve Users from my AD via a Web appliction. I ran this
script
> to populate a combobox in a normal app and it works...
> But when I use this script in a Web App it fails
> Any Idea Why?
>
> Marc
> Dim entry As New
> DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE")
>
> Dim mySearcher1 As New

System.DirectoryServices.DirectorySearcher(entry) >
> Dim result As System.DirectoryServices.SearchResult
>
> Dim oValue As New ArrayList
>
> Dim mySearcher
>
> For Each result In mySearcher.FindAll()
>

should this by MySearcher1?

> oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry().Name, > Len(result.GetDirectoryEntry().Name) - 3))
>
> Next
>
> User1.DataSource = oValue
>
> User1.Visible = True
>
>



Nov 20 '05 #10
No need to apoligize dude. =)

If I had a nickel for every time I made a typo like that... I'd have a sh...
well... lets just say enough that I wouldn't be spending my time on here. =)

Eh... who am I kidding, I'd be here no matter how much money I had...

"MDS" <ab*@abc.com> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
Your right...
Sorry...

"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...

"MDS" <ab*@abc.com> wrote in message
news:eu**************@TK2MSFTNGP12.phx.gbl...
All,

I want to retrieve Users from my AD via a Web appliction. I ran this

script
to populate a combobox in a normal app and it works...
But when I use this script in a Web App it fails
Any Idea Why?

Marc
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE")

Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)
Dim result As System.DirectoryServices.SearchResult

Dim oValue As New ArrayList

Dim mySearcher

For Each result In mySearcher.FindAll()


should this by MySearcher1?
oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry().Name, Len(result.GetDirectoryEntry().Name) - 3))

Next

User1.DataSource = oValue

User1.Visible = True



Nov 20 '05 #11
MDS
OK, problem solved...
Its was not AD related....
Thx anyway, stil a lot of questions, so you see me arround....;-)

1000 THX, without your help I couldn't get it to work.

Marc

"Philip Rieck" <st***@mckraken.com> wrote in message
news:er*************@TK2MSFTNGP11.phx.gbl...
What error does that give you ? (note that username and password should be a user that has credentials to that LDAP directory - try your own if you can
get it to work locally)

Your first LDAP string should search the default domain, while the second
looks at a particular server. Unfortunately, I am not an LDAP guru, and
can't really help you on that. I have to flop about in order to get LDAP
strings right myself.

Did you try the impersonation avenue at all?
"MDS" <ab*@abc.com> wrote in message
news:eB**************@tk2msftngp13.phx.gbl...
Philip, Adding that gives me an error...
Also when I use LDAP://dc:prod,dc=telenet,dc=be" then it gives an error
while running. When I use "LDAP://"servername" it doesn't...Any Idea? I'm
very new to VB.net, but have a lot experience in VBS

Marc

"Philip Rieck" <st***@mckraken.com> wrote in message
news:e8**************@tk2msftngp13.phx.gbl...
By default your web application will run under the machine account, which has no network privledges. You could either specify a username and

password
that has rights to access that LDAP root when you create "entry" (see the overloads for the DirectoryEntry constructor to pass credentials), or - you
could use impersonation in your web app. (do this only if people
hitting it
will be from an internal network, on your local domain).

To pass in credentials:
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE",
"userLogin", "Password")

To enable impersonation, in your web.config file, add this in the
<system.web> config section:
<identity impersonate="true"/>

(the impersonate key would also allow you to impersonate a specific
user for
that web application. See the docs for more information on asp.net's
identity tag, or this kb article
http://support.microsoft.com/default.aspx?kbid=306158)

"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...
>
> "MDS" <ab*@abc.com> wrote in message
> news:eu**************@TK2MSFTNGP12.phx.gbl...
> > All,
> >
> > I want to retrieve Users from my AD via a Web appliction. I ran

this > script
> > to populate a combobox in a normal app and it works...
> > But when I use this script in a Web App it fails
> > Any Idea Why?
> >
> > Marc
> > Dim entry As New
> > DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE") > >
> > Dim mySearcher1 As New

System.DirectoryServices.DirectorySearcher(entry)
> >
> > Dim result As System.DirectoryServices.SearchResult
> >
> > Dim oValue As New ArrayList
> >
> > Dim mySearcher
> >
> > For Each result In mySearcher.FindAll()
> >
>
> should this by MySearcher1?
>
> >

oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry().Name,
> > Len(result.GetDirectoryEntry().Name) - 3))
> >
> > Next
> >
> > User1.DataSource = oValue
> >
> > User1.Visible = True
> >
> >
>
>



Nov 20 '05 #12
Hi Marc,

I am glad that the problem has been resolved.

If you have any concern on this issue, please post here.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 20 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: J. Baute | last post by:
I'm caching data in the Application object to speed up certain pages on a website The main reason is that the retrieval of this data takes quite a while (a few seconds) and fetching the same data...
3
by: Amit Dedhia | last post by:
Hi I am developing a Dot net application (involving image processing) on a uni processor. It works well on my machine. I then take all my code on a multi processor, build and run the application...
6
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
20
by: Peter Oliphant | last post by:
How does one launch multiple forms in an application? Using Photoshop as an example, this application seems to be composed of many 'disjoint' forms. Yet, they all seem somewhat 'active' in...
6
by: Josef Brunner | last post by:
Hi, I published my application (VS 2005) and am now trying to install it when I get this error message. It worked before...even on a different machine. Here is the detailed description: ...
9
by: jeff | last post by:
Hi All. I realize that when my Deployed winforms application starts, Windows needs to load the .net 2 framework before control is given to my application.... Is there anyway to either ... -...
3
by: asadikhan | last post by:
Hi, I have written a windows application with a GUI (let's call it MENU). I own the code for this application and have access to it. We have another application that is a third-part windows...
2
by: Michael Kalika | last post by:
Hi, We have developed a VSTO 2005 Excel application and we would like to leverage ClickOnce deployment mechanism for distribution of this application. How can we do that? I was digging in MSDN...
0
by: Tifer | last post by:
Hello, I am building my first .Net Application. The first couple of Publish and Installs I did went fine. But after a couple of builds, I get a modal dialogue box error every time upon trying...
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.