List Info

Thread: C-Sharp (C#) Group: AspNetActiveDirectoryMembershipProvider




C-Sharp (C#) Group: AspNetActiveDirectoryMembershipProvider
user name
2006-03-14 12:25:36

Hi,

 

I'm trying to reset the password for ActiveDirectoryMembershipProvider using asp:changepassword Control so I 'm getting following error "The specified connection string does not represent a valid LDAP adspath"

 

 

Web.config

 

<connectionStrings>

 <;add name=";ADService&quot; connectionString=&quot;LDAP://S77955.domain.local/&quot; />

</connectionStrings>

  <system.web>

 &nbsp; &nbsp; &nbsp; <membership defaultProvider=";AspNetActiveDirectoryMembershipProvider&quot;>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; <providers>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  <add connectionStringName="ADService" enablePasswordReset=&quot;true&quot;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   name=&quot;AspNetActiveDirectoryMembershipProvider&quot; type="; System.Web.Security.ActiveDirectoryMembershipProvider" />

 &nbsp; &nbsp; &nbsp; &nbsp;   ; </providers>

 &nbsp; &nbsp; &nbsp; </membership>

 &nbsp; &nbsp; &nbsp; <authentication&gt;

 &nbsp; &nbsp;  <forms requireSSL="true" />

 &nbsp;  </authentication&gt;

 

if I remove backslash it showing following error

 

"The Active Directory membership provider does not support password reset without password question and answer."

 

 

Server Control:

<asp:changepassword id="ChangePassword1"

 &nbsp; &nbsp; &nbsp; &nbsp;   ; runat=&quot;server&quot;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; DisplayUserName=&quot;True";

 &nbsp; &nbsp; &nbsp; &nbsp;   ; SuccessText="Thank you"

 &nbsp; &nbsp; &nbsp; &nbsp;   ; CancelDestinationPageUrl="default.aspx"

 &nbsp; &nbsp; &nbsp; &nbsp;   ; ChangePasswordFailureText=";Sorry password not changed.&quot;

 &nbsp; &nbsp; &nbsp;  SuccessPageUrl=";ca.aspx&quot;

 >;

  </asp:changepassword>

 

Please help me out from this problem.


--
Regards,
Ramanjaneyulu Cheekatla
Mobile No: 9986040549
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

C-Sharp (C#) Group: Re: AspNetActiveDirectoryMembershipProvider
user name
2006-03-17 13:47:33
hi

This is how I Achieved...


<%
on error resume next
Dim UserName
UserName=Request.ServerVariables ("LOGON_USER")
UserName=Split(UserName,"\")
strUserCN = Trim(UserName(1))
response.write("You are logged in as:
"&strUserCN)

strOldPassword = request.form("oldpass")
strNewPassword = request.form("newpass")
strPassVerify = request.form("passverify")

if strOldPassword="" then
    response.write "<br>Change
Password<br><br>"
    response.write "<hr><form method=post
action=chngpwd.asp><table>"
    ' response.write "<tr><td>User Name:
</td><td><input type=text
name=cn></td><tr>"
    response.write "<tr><td>Old Password:
</td><td><input type=password
name=oldpass></td></tr>"
    response.write "<tr><td>New Password:
</td><td><input type=password
name=newpass></td></tr>"
    response.write "<tr><td>Verify
Password: </td><td><input
type=password
name=passverify></td></tr>"
    response.write "<tr
height='10'><td></td><td >
</td></tr>"
    response.write
"<tr><td>&nbsp;</td><td
><input type=submit
value='Reset Password'>&nbsp;&nbsp;<input
type=reset
value='Reset'></td></tr>"
    response.write "</table>"
    response.end
else

if strNewPassword = strPassVerify then

Dim Conn, strRS, RS, strConn
Set Conn =
Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")
Conn.Provider = "ADSDSOObject"
strConn = "Active Directory Provider"
Conn.Open strConn
SamName=strUserCN

strQuery = "Select AdsPath, CN  From 'LDAP://domain'
Where
objectClass='user' And sAMAccountName='" &
SamName & "'"
RS.Open strQuery, Conn,1,1
'Response.Write "Name:
"&RS(0)&"<br>Path:
"&RS(1)&"<br><br>"

set usr = GetObject(RS(1))
usr.ChangePassword strOldPassword,strNewPassword
usr.SetInfo

RS.close
Conn.close

else
    response.write
"<hr><br><br>"
    response.write "The password and confirmation do
not match. <a
href='JavaScript:history.go(-1);'  class='link'
><b>Click here to try"
_
& "again...</b></a>"
    response.end

end if
end if

If Err Then
        AdsiErr()
Else
    Response.Write "<br>Your password was
changed successfully  <a
href='default.aspx'  class='link'
><b>Back</b></a>"
        Response.end
End If

Sub AdsiErr()
        Dim e
        e = Err.Number
        h = Hex(e)

        If h = "80005000" Then
                Response.write "An invalid ADSI
pathname was passed. "
        Elseif h = "1A8" Then
                ServerName =
Request.ServerVariables("SERVER_NAME")
Response.write "<font color=red><b>The web
server " & ServerName & "
does not have permission to change passwords using HTML
mode." _
& "In order to be granted this permission, the web
server must be a
domain" _
& "controller in the " & domain &
" domain or this .asp script must be
served" _
& "by a domain admin account instead of the
IUSR_<I>MachineName</I>account.</b></fo
nt>"

Response.Write "<br><br><a
href='JavaScript:history.go(-1);'
class='link' ><b>Click here to try" _
&
"again...</b></a></font>"
        Elseif h = "800041E4" Then
                Response.write "<font
color=red><b>Username not found."
Response.Write "<br><br><a
href='JavaScript:history.go(-1);'><b>Click
here to try" _
&
"again...</b></a></font>"
        Elseif h = "8007052F" Then
Response.write "<font color=red><b>Your
password could not" _
& "be changed. Each password must be used for at
least x
days.</A></b></font>"
Response.Write "<br><br><a
href='/chngpwd.asp'><b>Click here to go " _
& "back to the login
page...</b></a></font>"
        Elseif h = "80070056" Then
Response.write "<font color=red><b>The
username or old" _
& "password is incorrect. <P> <A
HREF=chngpwd.asp?username=" & user
&">Please" _
& "try
again.</A></b></font>"
        Elseif h = "800708C5" Then
Response.write "<font color=red><b>The new
password does not" _
& "meet the password policies. The password may be
too short or you
have" _
& "already used this password recently. <P>
<A
HREF=chngpwd.asp?username="& user &
">Please try
again.</A></b></font>"
        Else
Response.write "<font color=red><b>Unable
to changepassword. Debugging
information:<P>"
Response.write "Unexpected Error " & e &
" (" & Hex(e) & ")"
Response.Write "<br><br><a
href='JavaScript:history.go(-1);'><b>Click
here to try " _
&
"again...</b></a></b></font>&
quot;
        End If
End Sub 
%>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )