|
I added a sitemap and then chose that as a source.
Then I get this:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Host 'fe80::ad93:da36:44e1:3cca%11' is not allowed to connect to this MySQL server
Source Error:
<siteMap>
<providers>
<add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</siteMap>
I never chose MySQL, what is going on?
|
|
|
|
|
hallo,
i need a help from you guys.
i have follow code from msdn how to login connect ldap.
but when i wanna change password to ldap, it won't work.
here's my LdapAuthentication.cs code:
using System;
using System.Text;
using System.Collections;
using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;
using System.DirectoryServices.ActiveDirectory;
namespace FormsAuth
{
public class LdapAuthentication
{
private string _path;
private string _filterAttribute;
public LdapAuthentication(string path)
{
_path = path;
}
public bool IsAuthenticated(string domain, string username, string pwd)
{
string _domain = domain;
string domainAndUsername = domain + @"\" + username;
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, pwd);
try
{
object obj = entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + username + ")";
search.PropertiesToLoad.Add("cn");
SearchResult result = search.FindOne();
if (null == result)
{
return false;
}
_path = result.Path;
_filterAttribute = (string)result.Properties["cn"][0];
}
catch (Exception ex)
{
throw new Exception("Error authenticating user. " + ex.Message);
}
return true;
}
public string GetGroups()
{
DirectorySearcher search = new DirectorySearcher(_path);
search.Filter = "(cn=" + _filterAttribute + ")";
search.PropertiesToLoad.Add("memberOf");
StringBuilder groupNames = new StringBuilder();
try
{
SearchResult result = search.FindOne();
int propertyCount = result.Properties["memberOf"].Count;
string dn;
int equalsIndex, commaIndex;
for (int propertyCounter = 0; propertyCounter < propertyCount; propertyCounter++)
{
dn = (string)result.Properties["memberOf"][propertyCounter];
equalsIndex = dn.IndexOf("=", 1);
commaIndex = dn.IndexOf(",", 1);
if (-1 == equalsIndex)
{
return null;
}
groupNames.Append(dn.Substring((equalsIndex + 1), (commaIndex - equalsIndex) - 1));
groupNames.Append("|");
}
}
catch (Exception ex)
{
throw new Exception("Error obtaining group names. " + ex.Message);
}
return groupNames.ToString();
}
}
}
and this is my ChangePassword.aspx code:
<%@ Page Title="Change Password" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="ChangePassword.aspx.cs" Inherits="FormsAuthAd.Account.ChangePassword" %>
<%@ Import Namespace="FormsAuth" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
Change Password
</h2>
<p>
Use the form below to change your password.
</p>
<p>
New passwords are required to be a minimum of <%= Membership.MinRequiredPasswordLength %> characters in length.
</p>
<asp:ChangePassword ID="ChangeUserPassword" runat="server" CancelDestinationPageUrl="~/Default.aspx" EnableViewState="false" RenderOuterTable="false"
SuccessPageUrl="ChangePasswordSuccess.aspx">
<ChangePasswordTemplate>
<asp:Literal ID="FailureText" runat="server"></asp:Literal>
<asp:ValidationSummary ID="ChangeUserPasswordValidationSummary" runat="server" CssClass="failureNotification"
ValidationGroup="ChangeUserPasswordValidationGroup"/>
<div class="accountInfo">
<fieldset class="changePassword">
<legend>Account Information</legend>
<p>
<asp:Label ID="Label1" runat="server">Domain:</asp:Label>
<asp:TextBox ID="txtDomain1" runat="server"></asp:TextBox>
</p>
<p>
<asp:Label ID="Label2" runat="server">Username:</asp:Label>
<asp:TextBox ID="txtUsername1" runat="server"></asp:TextBox>
</p>
<p>
<asp:Label ID="Label3" runat="server" AssociatedControlID="CurrentPassword">Old Password:</asp:Label>
<asp:TextBox ID="txtPassword1" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="CurrentPasswordRequired" runat="server" ControlToValidate="CurrentPassword"
CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Old Password is required."
ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
</p>
<p>
<asp:Label ID="Label4" runat="server" AssociatedControlID="NewPassword">New Password:</asp:Label>
<asp:TextBox ID="txtNewPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="NewPasswordRequired" runat="server" ControlToValidate="NewPassword"
CssClass="failureNotification" ErrorMessage="New Password is required." ToolTip="New Password is required."
ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
</p>
<p>
<asp:Label ID="Label5" runat="server" AssociatedControlID="ConfirmNewPassword">Confirm New Password:</asp:Label>
<asp:TextBox ID="txtConfirmNewPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" ControlToValidate="ConfirmNewPassword"
CssClass="failureNotification" Display="Dynamic" ErrorMessage="Confirm New Password is required."
ToolTip="Confirm New Password is required." ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
<asp:CompareValidator ID="NewPasswordCompare" runat="server" ControlToCompare="txtNewPassword" ControlToValidate="ConfirmNewPassword"
CssClass="failureNotification" Display="Dynamic" ErrorMessage="The Confirm New Password must match the New Password entry."
ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:CompareValidator>
</p>
</fieldset>
<p class="submitButton">
<asp:Button ID="CancelPushButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"/>
<asp:Button ID="ChangePasswordPushButton" runat="server" CommandName="ChangePassword" Text="Change Password"
ValidationGroup="ChangeUserPasswordValidationGroup" OnClick="Click_Change"/>
</p>
</div>
<script runat="server">
void Click_Change(object sender, EventArgs e)
{
string adPath = "LDAP://my-domain.com";
LdapAuthentication adAuth = new LdapAuthentication(adPath);
try
{
if(true == adAuth.ChangePassword(txtDomain1.Text, txtUsername1.Text, txtPassword1.Text))
{
Response.Redirect("~/Account/ChangePasswordSuccess.aspx");
}
else
{
errorLabel.Text = "Error Password!.";
}
}
catch(Exception ex)
{
errorLabel.Text = "Check It. " + ex.Message;
}
}
</script>
</ChangePasswordTemplate>
</asp:ChangePassword>
</asp:Content>
did i'm do something wrong?
what should i do to make void button change password will take old password and renew password to ldap?
anybody know how?
Thanks before.
|
|
|
|
|
You haven't shown the ChangePassword method on your LdapAuthentication class, so we can't tell you what you've done wrong.
But, based on the method call, you're not passing in the new password.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
can you give me a example of method on ldapauthentication?
because i still confuse.
if i want to change my password, should i make the changepassword.aspx connected with authentication?
thanks.
|
|
|
|
|
So you're saying that you haven't written the ChangePassword method on the LdapAuthentication class, and you're surprised that you get a compiler error when you try to call a method that doesn't exist?
This StackOverflow thread[^] has several examples. You'll want the ones that use the "change password" method, not the "set password" ones.
For example:
public bool ChangePassword(string domainName, string userName, string currentPassword, string newPassword)
{
string domainAndUsername = domainName + @"\" + userName;
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, currentPassword);
if (entry == null) return false;
DirectorySearcher search = new DirectorySearcher(directionEntry);
search.Filter = "(SAMAccountName=" + userName + ")";
SearchResult result = search.FindOne();
if (result == null) return false;
DirectoryEntry userEntry = result.GetDirectoryEntry();
if (userEntry == null) return false;
userEntry.Invoke("ChangePassword", new object[] { currentPassword, newPassword });
userEntry.CommitChanges();
return true;
}
It might be easier to use the DirectoryServices.AccountManagement classes instead of the raw DirectoryServices classes:
public class LdapAuthentication
{
private readonly ContextType _contextType;
public LdapAuthentication(ContextType contextType)
{
_contextType = contextType;
}
public bool IsAuthenticated(string username, string password)
{
using (var context = new PrincipalContext(_contextType))
{
return context.ValidateCredentials(username, password);
}
}
public string GetGroups(string username)
{
using (var context = new PrincipalContext(_contextType))
using (var user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, username))
{
if (user == null)
{
throw new InvalidOperationException(string.Format("User account '{0}' was not found.", username));
}
var groups = user.GetAuthorizationGroups();
return string.Join("|", groups.Select(g => g.Name));
}
}
public bool ChangePassword(string username, string currentPassword, string newPassword)
{
using (var context = new PrincipalContext(_contextType))
using (var user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, username))
{
if (user == null)
{
throw new InvalidOperationException(string.Format("User account '{0}' was not found.", username));
}
try
{
user.ChangePassword(currentPassword, newPassword);
return true;
}
catch (PasswordException)
{
return false;
}
}
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank your for give me sample,
I will do it next, because i try with another method. And some problem come back. I will try with your code, but i want to finish this first.
i've make changepassword1.cs and i make changepassword.aspx, but the error say the current password and newpassword not exist. i try to convert textbox to string like this:
string CP = ((TextBox)ChangeUserPassword.FindControl("CurrentPassword1")).Text;
but when i run it,
System.Web.HttpException: ChangeUserPassword: ChangePasswordTemplate does not contain an IEditableTextControl with ID CurrentPassword for the current password
how can i resolve this sir? Thanks before
|
|
|
|
|
Look at your ChangePassword.aspx code - do you have a textbox with the ID "CurrentPassword1 "?
Based on the code in your original message, you don't. The textbox is called "txtPassword1 ".
The ID you pass to the FindControl method needs to match the ID of the control in the markup.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
ok sorry for that,
i tried to use same ID, but i can't get the value also
now, i change the method,
i use hmtl form in my webapp
but i found some error again in invoke.
the error says:
Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))
in line 31(red code):
Line 29: if (result != null)
Line 30: {
Line 31: user.Invoke("ChangeUserPassword", new object[] { OldPassword, NewUPassword });
Line 32: user.Properties["LockOutTime"].Value = 0; //unlock account
Line 33: user.CommitChanges();
Stack Trace:
[COMException (0x80020006): Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))]
System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args) +119
FormsAuthAd.ChangePasswordPSI.ChangePass(HttpSessionState Session, String OldPassword, String NewUPassword) in C:\Users\Desktop\Documents\Visual Studio 2010\Projects\FormsAuthAd12\FormsAuthAd\ChangePasswordPSI.cs:31
[Exception]
FormsAuthAd.ChangePasswordPSI.ChangePass(HttpSessionState Session, String OldPassword, String NewUPassword) in C:\Users\Desktop\Documents\Visual Studio 2010\Projects\FormsAuthAd12\FormsAuthAd\ChangePasswordPSI.cs:44
ASP.webform2_aspx.ChangeMe_Click(Object sender, EventArgs e) in c:\Users\Desktop\Documents\Visual Studio 2010\Projects\FormsAuthAd12\FormsAuthAd\WebForm2.aspx:56
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9692746
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3562
Now, i still confuse with throw ex;
why i can't use it?
|
|
|
|
|
Look at your code, and then look at the sample I posted.
Your code:
user.Invoke("ChangeUserPassword", new object[] { OldPassword, NewUPassword });
The sample I posted:
userEntry.Invoke("ChangePassword", new object[] { currentPassword, newPassword });
Can you spot the difference?
The method is called ChangePassword , NOT ChangeUserPassword . That's why you're getting an exception telling you that the method you've tried to invoke is unknown.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi friends,
I need help to implement functionality of MULTIPLE.OPERATIONS which is there in excel into .net.
|
|
|
|
|
Do you have a question?
Raghavendra.Kodimala wrote: MULTIPLE.OPERATIONS Why is this all CAPITALS and why is there a period in it?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
This is functionality exist in tools menu in libreoffice. We can apply on set of fields. Any one who uses excel, can understand what am i asking
|
|
|
|
|
Raghavendra.Kodimala wrote: This is functionality exist in tools menu in libreoffice 1. You posted in the ASP.Net forum.
2. You then mentioned Excel.
3. Now you are mentioning Libre Office.
Can you see why this is confusing?
Raghavendra.Kodimala wrote: Any one who uses excel, I've used every version since 1995 and have no idea what you are asking. Rather than be rude, can you ask a clear question?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
I understood the what if analysis and concept of Multiple operations. But my exact requirement is i want to write a function with few parameters. In that first parameter is need to capture formula assigned to a variable. How can we write that?
|
|
|
|
|
This is the ASP.NET forum and it is far from clear what your problem is. Where and how do you plan to create this code? And indeed, what programming language you are talking about?
|
|
|
|
|
My problem is I am working on a new ASP.NET application where existing application is libreoffice. (Since it's also spread sheet, I am using term excel some times). In this libreoffice, I have encountered a function in a formula called MULTIPLE.OPERATIONS. I have studied about this function. It is not exactly a function, but it comes under what if analysis. This is in tools menu (libreoffice). I need to write a function in .net which behaves as MULTIPLE.OPERATIONS. There i got stucked and asking for help.
I am sorry if anybody takes rude or rash behavior from my written content.
|
|
|
|
|
Raghavendra.Kodimala wrote: I need to write a function in .net which behaves as MULTIPLE.OPERATIONS. Then you need to explain what this function is supposed to do, and exactly where you are stuck. You also need to explain how and where this fits into an ASP.NET application.
|
|
|
|
|
I already given explanation about this method. Again am explaining. This method consists three parameters. First parameter takes formula assigned to a variable. Second parameter takes the variable which need to be replaced in captured formula(first parameter). This function replaces second parameter in formula with third parameter which is also a variable. If second parameter not found in the captured formula, then function searches for second parameter variable in all variables formulas in the captured formula until it finds the second parameter variable. Then replaces with third parameter.
|
|
|
|
|
Hi Friends. I have done my project in asp.net with using webmethod concepts. I deployed it in live server. Clients are using windows 8 with IE 11/9. When users used my projects then IE version are changed to IE7. webmethod and json does not support IE 7/8. but when this page open then its automatically IE version changed and display 'JSON object' error. I tried to changed IE default version 9.but its automatically changed IE 7/8. how to change IE default version 9. what is the solution for my problem? Give me your suggestions.
|
|
|
|
|
It sounds like your headers are sent to IE7 compatibility.
Check the template page (your index.html/aspx/whatever) and make sure that the compatibility header is set correctly. For instance, for IE 9:
<head>
...
<meta http-equiv="X-UA-Compatible" content="IE=9" />
...
</head>
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Hi,
I also use this meta header name. But no use.
|
|
|
|
|
You did not say what the problem is !
|
|
|
|
|
Hi,
My problem is IE default version are automatically changed IE Edge to IE 7. But I want IE default version 9. How to changed default version of IE 9?
|
|
|
|
|
CAn you post your Meta tags.
|
|
|
|