|
Hi
I am using Visual Web Developer 2010 Express (with C# as code-behind) to develop a website.
I have created a custom MembershipProvider and I have specified that in the web.config that
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
I am not sure where and how to use these values.
I have done the following:
I have added a CustomValidator to the Password textbox in the CreateUserWizard .
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
<asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
<asp:CustomValidator ID="CustomValidator_PW" runat="server" ControlToValidate="Password"
OnServerValidate="CustomValidate_PW" ValidateEmptyText="true" Display="Dynamic"
ErrorMessage="" ForeColor="Red" ValidationGroup="RegisterUser">
</asp:CustomValidator>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required."
ValidationGroup="RegisterUser">*</asp:RequiredFieldValidator>
And a server-side method in the code-behind:
protected void CustomValidate_PW(object source, ServerValidateEventArgs args)
{
CustomValidator cv = (CustomValidator)source;
string pw = RegisterUser.Password;
if (pw.Length < Membership.MinRequiredPasswordLength)
{
cv.ErrorMessage = "Minimum Password length is " + Membership.MinRequiredPasswordLength;
args.IsValid = false;
}
if (Membership.MinRequiredNonAlphanumericCharacters > 0)
{
int count = 0;
for (int j = 0; j < pw.Length; j++)
{
if (!char.IsLetterOrDigit(pw[j]))
{
count++;
}
}
if (count < Membership.MinRequiredNonAlphanumericCharacters)
{
cv.ErrorMessage = "Password requires " + Membership.MinRequiredNonAlphanumericCharacters + " non-Aphanumeric characters";
args.IsValid = false;
}
}
}
Is there a better way or better place to do this?
All help will be appreciated.
Kobus
|
|
|
|
|
my computer have ms-sql 2005, 2008.
i select web.config like this
<add key="dsn" value="data source=localhost;initial catalog=PERSON_database;uid=sa;pwd=1111;persist security info=False;packet size=4096"/>
but i only connect mssql2005.
how can i connect mssql 2008?
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
I think the connection string you mentioned is for database in 2005. Similarly add another connection string pointing to database in sql 2008.
|
|
|
|
|
It means a SQL 2005 server instance has been installed as the default instance, which enables you to specify localhost as the data source. SQL 2008 server must have been installed as a named instance (since there can be only one default instance). Find out the name of the named instance and use it in your connection string like this.
data source=localhost\mySql2k8instance
You can find the name of your SQL 2008 instance by looking at the list of serivces in services.msc .
|
|
|
|
|
Hello friends
I am using gridview in one of my application.In this application i am binding gridview to data table. In gridview one column is invisible(visible="false"). Now i want to take the value from invisible gridview column and display it into text box.
But i am not able to do it so please help me ASAP.
|
|
|
|
|
Just loop through the gridview.
List<string> gridviewDatas = new List<string>();
for(i=0;i>[GridviewID].Rows.Count;i==)
{
gridviewDatas.Add([GridviewName].Rows[i].Cells[CellIndex].Text);
} ------
[TextBoxID].Text = GridviewName.Rows[the row number that you need the data of].Cells[put the cell number that you want the data of].Text;
-----
Sometimes I can not retrieve the data. Before binding the gridview make the columns visible and after binding make the visibilty property false that you dont want to see.
Something like;
for(i=0;i>[GridViewName].Columns.Count;i++)
{
[GridviewName].Column[i].Visible = true;
}
GridviewName.DataSource = dtsrc;
GridviewName.DataBind();
[GridviewName].Column[index].Visible = false;
|
|
|
|
|
Don't set it to invisible. If you do, the program won't even bother sending it along.
Use CSS and give that column (and it's Header) a value like this:
CssClass="NotShown"
where NotShown is a CSS class like this:
.NotShown
{
display: none;
}
The data will be there in the grid, but not visible in the browser, and you can access it in the code behind like this or similar:
GridViewRow selectedRow = GRID.Rows[index];
TableCell HiddenColumn = selectedRow.Cells[5];
(in this example, the hidden column is number 5, of course)
|
|
|
|
|
What is the code in Web Project in web page.
when we send the verification link in user E-mail Id (e.g kumar.akshaya9@gmail.com in inbox).
|
|
|
|
|
Is this a question?
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
www.cacttus.com
|
|
|
|
|
Do not use your email address in posts. In any case, restate your question; what you have said makes no sense.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Do you mean mailto[^]?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
How to identify a particular Web site is not active ?
can i get any C# sample code for this ?
|
|
|
|
|
Don't cross post. People are busy and will answer if and when.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
How can Interchange the Arabic Language to English by check boxes for a Arabic web project?
Immediately reply me.
|
|
|
|
|
Naseem Alam Ansari wrote: Immediately reply me.
Dude, you cant push others to reply on your question! First try to fix by yourself and wait if someone in this forum will give you any help.
You didn't notice in your question your attempt which you had made to fix your problem.
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
www.cacttus.com
|
|
|
|
|
We are not your servants.
Ask your question, but do so in a civil manner.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Hi
I am using Visual Web Developer 2010 Express (with C# as code-behind) to develop a website.
I have created a custom MembershipProvider and I have specified that in the web.config that requiresUniqueEmail="true" .
In the CreateUser() method I check whether the email that the new user has entered is unique and the code works. How do I then display a message to the user in the CreateUserWizard if the email he has entered is not unique?
I thought I could reference the CreateUserWizard in the CreateUser() method, but the following does not work:
Label labelDuplicateEmail = (Label)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("LabelDuplicateEmail");
labelDuplicateEmail.Text = "Email already exists in the database.";
All help will be appreciated.
Kobus
|
|
|
|
|
Hi
I have managed to figure it out. I am using the CreateUserError event of the CreateUserWizard .
protected void RegisterUser_CreateUserError(object sender, CreateUserErrorEventArgs e)
{
Label labelDuplicateEmail = (Label)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("LabelDuplicateEmail");
labelDuplicateEmail.Text = string.Empty;
if (e.CreateUserError == System.Web.Security.MembershipCreateStatus.DuplicateEmail)
{
labelDuplicateEmail.Text = "Email address already exists in the database.";
}
}
Kobus
|
|
|
|
|
how to remove title in showmodeldialog '--webPagedialog'
|
|
|
|
|
A 'hacky' way is to add a large number of after your own title to push that off the right edge of the title bar.
Alternatively have a look at this: Ajax Control Toolkit ModalPopup[^]
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
modified on Monday, July 25, 2011 7:24 AM
|
|
|
|
|
Hi
i need to allocate students to the exam hall,These are the rules for placing an exam to a room:
1. If total of students is bigger than the biggest room capability, then the class will be split. (ex. if the total of students is 120, but the biggest capacity of room is 40, then the exam will be split into three rooms)
2. One room can handle two (maximum, cant more than 2 exams) exams at the same time and day.
I am going to minimize the use of room and day. So the exam will be held densely (lets say, if the timetable made by human will product a timetable for 12 days, i want to minimize it to 10 days.. or 9 days
can you give me what logic i should start with.
thanks
|
|
|
|
|
Ok, and now you want logic for query or to design your web application?
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
www.cacttus.com
|
|
|
|
|
Hi
Logic for design
thanks
|
|
|
|
|
sathimailin1 wrote: can you give me what logic i should start with.
You have specified the logic in your question, just write down how you would calculate how many rooms you need, how many exams you can run per day, etc.
The best things in life are not things.
|
|
|
|
|
if this is a "real" problem, then you should also consider that all students taking the "history exam" need to be scheduled on the same day. Otherwise the students who take the exam on day 1 will tell the students on day 2 about the exam.
This sounds too much like a homework assignment, so your not going to get specific help in doing your homework.
|
|
|
|