473,569 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP LDAP Query working on localhost but not webserver

Sorry everyone,

NOTE: I have posted this question to another site but unfortunately,
am not getting the answers I need only because those helping haven't
worked with ASP.

I am in desperate need of a fix. I am using classic asp and making a
connection to LDAP server using SQL code under IIS 5 on my localhost
and it works great. I have a form and form fields that pull from
active directory. Now, once I get the web team to deploy these files
to the webserver where all users will be able to run this app.(this
server is using IIS 6), my form fields show up blank. For the life of
me I cannot see what is wrong or different except the IIS version.
Also, I have gotten the IIS logs and they don't tell me anything.

Expand|Select|Wrap|Line Numbers
  1. UserSelect= instr(Session("User"),"\")
  2. user = Mid(Session("User"), UserSelect + 1, len(Session("User"))-
  3. UserSelect)
  4.  
  5. Set objConnection = CreateObject("ADODB.Connection")
  6. Set objCommand =   CreateObject("ADODB.Command")
  7. Set objCommand1 =   CreateObject("ADODB.Command")
  8. objConnection.Provider = "ADsDSOObject"
  9. objConnection.Open "Active Directory Provider"
  10. Set objCommand.ActiveConnection = objConnection
  11.  
  12. 'objCommand.Properties("Page Size") = 1
  13.  
  14. 'objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
  15.  
  16. objCommand.CommandText = _
  17.  
  18. "SELECT GivenName, mail, telephoneNumber FROM 'LDAP Server(hidden for
  19. security)' WHERE sAMAccountName ='" & user  & "'"
  20.  
  21. Set objRecordSet = objCommand.Execute
  22.  
Any ideas why it works locally but not on the webserver? Thanks.

Sep 15 '07 #1
7 7020
On Sep 15, 12:54 am, MrHelpMe <clintto...@hot mail.comwrote:
Sorry everyone,

NOTE: I have posted this question to another site but unfortunately,
am not getting the answers I need only because those helping haven't
worked with ASP.

I am in desperate need of a fix. I am using classic asp and making a
connection to LDAP server using SQL code under IIS 5 on my localhost
and it works great. I have a form and form fields that pull from
active directory. Now, once I get the web team to deploy these files
to the webserver where all users will be able to run this app.(this
server is using IIS 6), my form fields show up blank. For the life of
me I cannot see what is wrong or different except the IIS version.
Also, I have gotten the IIS logs and they don't tell me anything.

Expand|Select|Wrap|Line Numbers
  1. UserSelect= instr(Session("User"),"\")
  2. user = Mid(Session("User"), UserSelect + 1, len(Session("User"))-
  3. UserSelect)
  4. Set objConnection = CreateObject("ADODB.Connection")
  5. Set objCommand =   CreateObject("ADODB.Command")
  6. Set objCommand1 =   CreateObject("ADODB.Command")
  7. objConnection.Provider = "ADsDSOObject"
  8. objConnection.Open "Active Directory Provider"
  9. Set objCommand.ActiveConnection = objConnection
  10. 'objCommand.Properties("Page Size") = 1
  11. 'objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
  12. objCommand.CommandText = _
  13.  "SELECT GivenName, mail, telephoneNumber FROM 'LDAP Server(hidden for
  14. security)' WHERE sAMAccountName ='" & user  & "'"
  15. Set objRecordSet = objCommand.Execute
  16.  

Any ideas why it works locally but not on the webserver? Thanks.
Sorry I forgot to mention my iis security settings are Integrated
windows authentication. That's it.

Sep 15 '07 #2

"MrHelpMe" <cl********@hot mail.comwrote in message
news:11******** **************@ w3g2000hsg.goog legroups.com...
On Sep 15, 12:54 am, MrHelpMe <clintto...@hot mail.comwrote:
>Sorry everyone,

NOTE: I have posted this question to another site but unfortunately,
am not getting the answers I need only because those helping haven't
worked with ASP.

I am in desperate need of a fix. I am using classic asp and making a
connection to LDAP server using SQL code under IIS 5 on my localhost
and it works great. I have a form and form fields that pull from
active directory. Now, once I get the web team to deploy these files
to the webserver where all users will be able to run this app.(this
server is using IIS 6), my form fields show up blank. For the life of
me I cannot see what is wrong or different except the IIS version.
Also, I have gotten the IIS logs and they don't tell me anything.

Expand|Select|Wrap|Line Numbers
  1. UserSelect= instr(Session("User"),"\")
  2. user = Mid(Session("User"), UserSelect + 1, len(Session("User"))-
  3. UserSelect)
  4. Set objConnection = CreateObject("ADODB.Connection")
  5. Set objCommand =   CreateObject("ADODB.Command")
  6. Set objCommand1 =   CreateObject("ADODB.Command")
  7. objConnection.Provider = "ADsDSOObject"
  8. objConnection.Open "Active Directory Provider"
  9. Set objCommand.ActiveConnection = objConnection
  10. 'objCommand.Properties("Page Size") = 1
  11. 'objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
  12. objCommand.CommandText = _
  13.  "SELECT GivenName, mail, telephoneNumber FROM 'LDAP Server(hidden for
  14. security)' WHERE sAMAccountName ='" & user  & "'"
  15. Set objRecordSet = objCommand.Execute

Any ideas why it works locally but not on the webserver? Thanks.

Sorry I forgot to mention my iis security settings are Integrated
windows authentication. That's it.
What are the security settings on the live web server. If it's integrated
security, have you tried it with your login, and is the login in the same
domain as your local system? If it's anonymous, the anonymous user context
will need sufficient privileges to access LDAP.

-Mark

Sep 16 '07 #3
On Sep 15, 10:42 pm, "Mark J. McGinty" <mmcgi...@spamf romyou.com>
wrote:
"MrHelpMe" <clintto...@hot mail.comwrote in message

news:11******** **************@ w3g2000hsg.goog legroups.com...


On Sep 15, 12:54 am, MrHelpMe <clintto...@hot mail.comwrote:
Sorry everyone,
NOTE: I have posted this question to another site but unfortunately,
am not getting the answers I need only because those helping haven't
worked with ASP.
I am in desperate need of a fix. I am using classic asp and making a
connection to LDAP server using SQL code under IIS 5 on my localhost
and it works great. I have a form and form fields that pull from
active directory. Now, once I get the web team to deploy these files
to the webserver where all users will be able to run this app.(this
server is using IIS 6), my form fields show up blank. For the life of
me I cannot see what is wrong or different except the IIS version.
Also, I have gotten the IIS logs and they don't tell me anything.
Expand|Select|Wrap|Line Numbers
  1. UserSelect= instr(Session("User"),"\")
  2. user = Mid(Session("User"), UserSelect + 1, len(Session("User"))-
  3. UserSelect)
Expand|Select|Wrap|Line Numbers
  1.         
  2.                         
  3.                 Set objConnection = CreateObject("ADODB.Connection")
  4. Set objCommand =   CreateObject("ADODB.Command")
  5. Set objCommand1 =   CreateObject("ADODB.Command")
  6. objConnection.Provider = "ADsDSOObject"
  7. objConnection.Open "Active Directory Provider"
  8. Set objCommand.ActiveConnection = objConnection
  •  
  •         
  •                         
  •                 'objCommand.Properties("Page Size") = 1
  •  
  •         
  •                         
  •                 'objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
  •  
  •         
  •                         
  •                 objCommand.CommandText = _
  •  
  •         
  •                         
  •                  "SELECT GivenName, mail, telephoneNumber FROM 'LDAP Server(hidden for
  • security)' WHERE sAMAccountName ='" & user  & "'"
  •  
  •         
  •                         
  •                 Set objRecordSet = objCommand.Execute
  •  
  •  
  • Any ideas why it works locally but not on the webserver? Thanks.
    Sorry I forgot to mention my iis security settings are Integrated
    windows authentication. That's it.

    What are the security settings on the live web server. If it's integrated
    security, have you tried it with your login, and is the login in the same
    domain as your local system? If it's anonymous, the anonymous user context
    will need sufficient privileges to access LDAP.

    -Mark- Hide quoted text -

    - Show quoted text - Hi Mark,
    The security settings are integrated security. Not sure what you mean
    have I tried it with my login? The code is taking my windows NT login
    and passing that to the LDAP query for retrieval. So I think the
    answer to that is yes but no values are showing up. Yes the login is
    in the same domain as my local system. Any other ideas? Thanx for
    you help.

    Sep 16 '07 #4

    "MrHelpMe" <cl********@hot mail.comwrote in message
    news:11******** **************@ n39g2000hsh.goo glegroups.com.. .
    On Sep 15, 10:42 pm, "Mark J. McGinty" <mmcgi...@spamf romyou.com>
    wrote:
    >"MrHelpMe" <clintto...@hot mail.comwrote in message

    news:11******* *************** @w3g2000hsg.goo glegroups.com.. .


    On Sep 15, 12:54 am, MrHelpMe <clintto...@hot mail.comwrote:
    Sorry everyone,
    >NOTE: I have posted this question to another site but unfortunately,
    am not getting the answers I need only because those helping haven't
    worked with ASP.
    >I am in desperate need of a fix. I am using classic asp and making a
    connection to LDAP server using SQL code under IIS 5 on my localhost
    and it works great. I have a form and form fields that pull from
    active directory. Now, once I get the web team to deploy these files
    to the webserver where all users will be able to run this app.(this
    server is using IIS 6), my form fields show up blank. For the life of
    me I cannot see what is wrong or different except the IIS version.
    Also, I have gotten the IIS logs and they don't tell me anything.
    >
    Expand|Select|Wrap|Line Numbers
    1. UserSelect= instr(Session("User"),"\")
    2. user = Mid(Session("User"), UserSelect + 1, len(Session("User"))-
    3. UserSelect)
    Expand|Select|Wrap|Line Numbers
    1.         
    2.                 >Set objConnection = CreateObject("ADODB.Connection")
    3. Set objCommand =   CreateObject("ADODB.Command")
    4. Set objCommand1 =   CreateObject("ADODB.Command")
    5. objConnection.Provider = "ADsDSOObject"
    6. objConnection.Open "Active Directory Provider"
    7. Set objCommand.ActiveConnection = objConnection
  •  
  •         
  •                 >'objCommand.Properties("Page Size") = 1
  •  
  •         
  •                 >'objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
  •  
  •         
  •                 >objCommand.CommandText = _
  •  
  •         
  •                 > "SELECT GivenName, mail, telephoneNumber FROM 'LDAP Server(hidden for
  • security)' WHERE sAMAccountName ='" & user  & "'"
  •  
  •         
  •                 >Set objRecordSet = objCommand.Execute
  •  
  •  
  • >Any ideas why it works locally but not on the webserver? Thanks.
    Sorry I forgot to mention my iis security settings are Integrated
    windows authentication. That's it.

    What are the security settings on the live web server. If it's
    integrated
    security, have you tried it with your login, and is the login in the same
    domain as your local system? If it's anonymous, the anonymous user
    context
    will need sufficient privileges to access LDAP.

    -Mark- Hide quoted text -

    - Show quoted text -
    Hi Mark,
    The security settings are integrated security. Not sure what you mean
    have I tried it with my login? The code is taking my windows NT login
    and passing that to the LDAP query for retrieval. Right... maybe your system is flagged as trusted for delegation and the web
    server is not?
    So I think the
    answer to that is yes but no values are showing up. Yes the login is
    in the same domain as my local system. Any other ideas? Thanx for
    you help.
    You don't show the code where you output the values of the recordset fields,
    are you sure the recordset is being opened? (Check its state property.)
    Have you examined the contents of the Connection.Erro rs collection? If you
    have errors disabled, comment the 'on error resume next' line to find out
    exactly where [and hopefully even why] the error is occurring.

    I suspect the issue has something to do with security, so if it was my
    project (barring any relevant info from error messages to the contrary) that
    is where I would look.

    -Mark


    Sep 16 '07 #5
    On Sep 16, 3:08 pm, "Mark J. McGinty" <mmcgi...@spamf romyou.com>
    wrote:
    "MrHelpMe" <clintto...@hot mail.comwrote in message

    news:11******** **************@ n39g2000hsh.goo glegroups.com.. .


    On Sep 15, 10:42 pm, "Mark J. McGinty" <mmcgi...@spamf romyou.com>
    wrote:
    "MrHelpMe" <clintto...@hot mail.comwrote in message
    >news:11******* *************** @w3g2000hsg.goo glegroups.com.. .
    On Sep 15, 12:54 am, MrHelpMe <clintto...@hot mail.comwrote:
    Sorry everyone,
    NOTE: I have posted this question to another site but unfortunately,
    am not getting the answers I need only because those helping haven't
    worked with ASP.
    I am in desperate need of a fix. I am using classic asp and making a
    connection to LDAP server using SQL code under IIS 5 on my localhost
    and it works great. I have a form and form fields that pull from
    active directory. Now, once I get the web team to deploy these files
    to the webserver where all users will be able to run this app.(this
    server is using IIS 6), my form fields show up blank. For the life of
    me I cannot see what is wrong or different except the IIS version.
    Also, I have gotten the IIS logs and they don't tell me anything.
    Expand|Select|Wrap|Line Numbers
    1. UserSelect= instr(Session("User"),"\")
    2. user = Mid(Session("User"), UserSelect + 1, len(Session("User"))-
    3. UserSelect)
    Expand|Select|Wrap|Line Numbers
    1.         
    2.                         
    3.                 Set objConnection = CreateObject("ADODB.Connection")
    4. Set objCommand =   CreateObject("ADODB.Command")
    5. Set objCommand1 =   CreateObject("ADODB.Command")
    6. objConnection.Provider = "ADsDSOObject"
    7. objConnection.Open "Active Directory Provider"
    8. Set objCommand.ActiveConnection = objConnection
  •  
  •         
  •                         
  •                 'objCommand.Properties("Page Size") = 1
  •  
  •         
  •                         
  •                 'objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
  •  
  •         
  •                         
  •                 objCommand.CommandText = _
  •  
  •         
  •                         
  •                  "SELECT GivenName, mail, telephoneNumber FROM 'LDAP Server(hidden for
  • security)' WHERE sAMAccountName ='" & user  & "'"
  •  
  •         
  •                         
  •                 Set objRecordSet = objCommand.Execute
  •  
  •  
  • Any ideas why it works locally but not on the webserver? Thanks.
    Sorry I forgot to mention my iis security settings are Integrated
    windows authentication. That's it.
    What are the security settings on the live web server. If it's
    integrated
    security, have you tried it with your login, and is the login in the same
    domain as your local system? If it's anonymous, the anonymous user
    context
    will need sufficient privileges to access LDAP.
    -Mark- Hide quoted text -
    - Show quoted text -
    Hi Mark,
    The security settings are integrated security. Not sure what you mean
    have I tried it with my login? The code is taking my windows NT login
    and passing that to the LDAP query for retrieval.

    Right... maybe your system is flagged as trusted for delegation and the web
    server is not?
    So I think the
    answer to that is yes but no values are showing up. Yes the login is
    in the same domain as my local system. Any other ideas? Thanx for
    you help.

    You don't show the code where you output the values of the recordset fields,
    are you sure the recordset is being opened? (Check its state property.)
    Have you examined the contents of the Connection.Erro rs collection? If you
    have errors disabled, comment the 'on error resume next' line to find out
    exactly where [and hopefully even why] the error is occurring.

    I suspect the issue has something to do with security, so if it was my
    project (barring any relevant info from error messages to the contrary) that
    is where I would look.

    -Mark- Hide quoted text -

    - Show quoted text - O.k Mark,
    I think you are on to something. I forgot I had on error resume.....:
    ( so I removed the code. Now hopefully you could explain what is
    wrong as I am getting the error
    Microsoft VBScript runtime error '800a000d'

    Type mismatch Line 276.

    Line 276 is as follows....exac tly what you wanted to see.
    Expand|Select|Wrap|Line Numbers
    1. <TD width="392"><INPUT type="text" name="RequestorFirstName" value="<
    2. %=Trim(objRecordSet("GivenName"))%>"></TD>
    3.  
    Can you see anything wrong because I can't? Also, why would it work
    on my localhost without error but not here? Thanks again for you
    help.

    Sep 17 '07 #6
    [Please trim when responding]

    "MrHelpMe" wrote:
    Microsoft VBScript runtime error '800a000d'

    Type mismatch Line 276.

    Line 276 is as follows....exac tly what you wanted to see.
    Expand|Select|Wrap|Line Numbers
    1. <TD width="392"><INPUT type="text" name="RequestorFirstName" value="<
    2. %=Trim(objRecordSet("GivenName"))%>"></TD>
    3.  
    The type mismatch probably comes from VBScript's Trim function, which
    requires a string. You used a notational shortcut for
    objRecordSet.Fi elds("GivenName ").Value, which VBScript allows you to do
    because it supports default properties on ADODB.Recordset objects.

    Normally, this works great, but what if the recordset is empty, as I suspect
    yours is? What happens if you pass an object or a Null value to a function
    that requires a string?

    http://msdn2.microsoft.com/en-us/library/c623wz83.aspx

    Can you see anything wrong because I can't? Also, why would it work on
    my localhost without error but not here?
    Simple. If the recordset is empty, it will behave differently. Try disabling
    Integrated Windows Authentication on localhost, and you will probably see a
    similar error. I believe your AD query is not returning any records.
    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms.

    Sep 17 '07 #7
    Hi Dave,

    "Normally, this works great, but what if the recordset is empty, as I
    suspect
    yours is? What happens if you pass an object or a Null value to a
    function
    that requires a string?"

    Actually, my recordset is not empty. It is taking the user session
    and using that to filter the AD Query and my name definitely comes up
    in the user session as I response.write the session. I will have a
    closer look at the code though.

    Sep 17 '07 #8

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

    Similar topics

    0
    4078
    by: Kmart | last post by:
    Hi all I've been looking around google and the net searching for a way to sort the result of an LDAP-query without any luck. Is it possible to do this or do I have to make my own sorting routine in java to go through the resutset? I'm using standard(jdk1.3.1) javax.naming classes (like DirContext and SearchControls). thanks
    2
    8097
    by: Robert Bryan via .NET 247 | last post by:
    Hello, Is there any way to determine which server answers an LDAP query? One that is not directed at a particular server that is. ie. DirectoryEntry oUser=new DirectoryEntry("LDAP://Domain/DC=Domain,DC=COM","","",AuthenticationTypes.Secure); Thanks, Bob
    1
    4213
    by: dln | last post by:
    Hello all. I'm trying to find the right group to post this to and since it's a coding question (of sorts), hopefully this is the right place. I'm attempting to run an LDAP query to return the Recipient Update Policies on an Exchange server using the DirectorySearcher class, but it's not returning any results. The following is a snippet of...
    3
    1661
    by: maria.s | last post by:
    Hi, I've got a problem with an LDAP query submitted from my ASP.NET application. Configuration: Windows 2003 Server Standard Ed., the application uses Windows Integrated Authentication and is configured with <identity impersonate=”true” /> I try to submit the following query: Dim IdentityName as String = Context.User.Identity.Name
    5
    1976
    by: MDS | last post by:
    Hey, First of all Best Wishes for 2004 I'm a system admin and I want to write a framework for our Helpdesk to do some daily stuff like creating mailboxes (not user related), (des)enabling SIP, putting users in groups, you all know the stuff. I'm quite new to .NET2003 and I found a tool ADSE.MSI on the MS webstit, only this is for...
    0
    365
    by: Kenneth H. Young | last post by:
    I am having difficulties with an LDAP client I'm writing. What I have discovered causes the error is when the client queries the LDAP server and a record contains two values entered in one field that is semicolon ";" separated. i.e. A telephone number. In RED below. How can I handle this? Thanks is advance for any help. Note: The LDAP...
    1
    6596
    by: Tatopitta | last post by:
    Hi all, I've read many times some threads with this problem but no answer is simple and good enough. Here's my situation:I've developed a web application with query LDAP which from System.Environment.UserName gets Name,Department, and so on. It works fine if I access the site with http://localhost/Site, but if I use http://Server/Site it...
    2
    2653
    by: HamishC | last post by:
    Hi all, I have been knocking my head against this one for a few days -- haven't been able to find a solution to this anywhere so hopefully someone can help. Situation: A really simple LDAP that searches for a users AD account - it works for some users, not for others. More bizarrely, for some people it seems to work occassionally. Setup:...
    1
    2239
    by: fatmitch | last post by:
    Hi, I have just installed a 2003 DC to our 2000 Domain and the only problem i'm getting is from our intranet server, the ASP script which authenticates users with AD is getting the following error when the the intranet server is using my new DC as it default LDAP server : mbloggsmsg: login failed This script is still working as long as i...
    0
    7694
    marktang
    by: marktang | last post by:
    ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
    0
    7609
    by: Hystou | last post by:
    Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
    0
    7921
    Oralloy
    by: Oralloy | last post by:
    Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
    0
    8118
    jinu1996
    by: jinu1996 | last post by:
    In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
    0
    7964
    tracyyun
    by: tracyyun | last post by:
    Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
    0
    5217
    by: conductexam | last post by:
    I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
    0
    3651
    by: TSSRALBI | last post by:
    Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
    1
    1208
    muto222
    by: muto222 | last post by:
    How can i add a mobile payment intergratation into php mysql website.
    0
    936
    bsmnconsultancy
    by: bsmnconsultancy | last post by:
    In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

    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.