Thursday, March 29, 2012
login control remember me doesn't work
the remember me feature isn't working. We all have cookies and js enabled.
Any suggestions on how to diagnose this?
My login aspx:
<asp:Login ID="Login1" runat="server" BackColor="#FFFFCC"
BorderColor="#5400A8" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px
"
Font-Names="Verdana,Arial" Font-Size="12px" ForeColor="#333333"
MembershipProvider="myMembershipProvider" PasswordRecoveryText="Can't
remember your password?" PasswordRecoveryUrl="PwdRecovery.aspx"
Height="150px" Width="245px"> <TitleTextStyle BackColor="#5400A8"
Font-Bold="True" Font-Size="14px" ForeColor="White" />
<InstructionTextStyle Font-Italic="True" ForeColor="#5400A8" />
<TextBoxStyle Font-Size="14px" />
<LoginButtonStyle Font-Names="Verdana" Font-Size="12px" ForeColor="#5400A8"
/>
My web config:
<authentication mode="Forms" >
<forms name="CCAuth"
loginUrl="myLogin.aspx"
timeout="20"
slidingExpiration="true"
cookieless="AutoDetect"
protection="All"
requireSSL="false"
enableCrossAppRedirects="false"
defaultUrl="default.asp"
path="/" />
</authentication>
<membership defaultProvider="myMembershipProvider">
<providers>
<add name="myMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="myDB"
applicationName="/"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="true"
passwordFormat="Hashed"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
maxInvalidPasswordAttempts="10" />
</providers>
</membership>Dabbler <Dabbler@.discussions.microsoft.com>'s wild thoughts
were released on Thu, 29 Jun 2006 06:54:02 -0700 bearing the
following fruit:
>I have a login page which requires all users to login everytime they visit,
>the remember me feature isn't working. We all have cookies and js enabled.
IIRC the timeout was changed thus rendering the 'remember
me' feature useless, so you need to set a timeout in your
web config to get it working again.
somthing like
<authentication mode="Forms">
<forms timeout="43200"/>
</authentication>
J
>Any suggestions on how to diagnose this?
>
>My login aspx:
><asp:Login ID="Login1" runat="server" BackColor="#FFFFCC"
>BorderColor="#5400A8" BorderPadding="4" BorderStyle="Solid" BorderWidth="1p
x"
>Font-Names="Verdana,Arial" Font-Size="12px" ForeColor="#333333"
>MembershipProvider="myMembershipProvider" PasswordRecoveryText="Can't
>remember your password?" PasswordRecoveryUrl="PwdRecovery.aspx"
>Height="150px" Width="245px"> <TitleTextStyle BackColor="#5400A8"
>Font-Bold="True" Font-Size="14px" ForeColor="White" />
><InstructionTextStyle Font-Italic="True" ForeColor="#5400A8" />
><TextBoxStyle Font-Size="14px" />
><LoginButtonStyle Font-Names="Verdana" Font-Size="12px" ForeColor="#5400A8"
/>
>My web config:
> <authentication mode="Forms" >
> <forms name="CCAuth"
> loginUrl="myLogin.aspx"
> timeout="20"
> slidingExpiration="true"
> cookieless="AutoDetect"
> protection="All"
> requireSSL="false"
> enableCrossAppRedirects="false"
> defaultUrl="default.asp"
> path="/" />
> </authentication>
> <membership defaultProvider="myMembershipProvider">
> <providers>
> <add name="myMembershipProvider"
> type="System.Web.Security.SqlMembershipProvider"
> connectionStringName="myDB"
> applicationName="/"
> enablePasswordRetrieval="false"
> enablePasswordReset="true"
> requiresQuestionAndAnswer="true"
> requiresUniqueEmail="true"
> passwordFormat="Hashed"
> minRequiredPasswordLength="6"
> minRequiredNonalphanumericCharacters="0"
> maxInvalidPasswordAttempts="10" />
> </providers>
> </membership>
Jan Hyde (VB MVP)
"Caring for Fine Wood" by Lindsey Doyle (David Reihmer)
login control remember me doesnt work
the remember me feature isn't working. We all have cookies and js enabled.
Any suggestions on how to diagnose this?
My login aspx:
<asp:Login ID="Login1" runat="server" BackColor="#FFFFCC"
BorderColor="#5400A8" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px"
Font-Names="Verdana,Arial" Font-Size="12px" ForeColor="#333333"
MembershipProvider="myMembershipProvider" PasswordRecoveryText="Can't
remember your password?" PasswordRecoveryUrl="PwdRecovery.aspx"
Height="150px" Width="245px"> <TitleTextStyle BackColor="#5400A8"
Font-Bold="True" Font-Size="14px" ForeColor="White" />
<InstructionTextStyle Font-Italic="True" ForeColor="#5400A8" />
<TextBoxStyle Font-Size="14px" />
<LoginButtonStyle Font-Names="Verdana" Font-Size="12px" ForeColor="#5400A8" /
My web config:
<authentication mode="Forms" >
<forms name="CCAuth"
loginUrl="myLogin.aspx"
timeout="20"
slidingExpiration="true"
cookieless="AutoDetect"
protection="All"
requireSSL="false"
enableCrossAppRedirects="false"
defaultUrl="default.asp"
path="/" />
</authentication>
<membership defaultProvider="myMembershipProvider">
<providers>
<add name="myMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="myDB"
applicationName="/"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="true"
passwordFormat="Hashed"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
maxInvalidPasswordAttempts="10" />
</providers>
</membership>Dabbler <Dabbler@.discussions.microsoft.com>'s wild thoughts
were released on Thu, 29 Jun 2006 06:54:02 -0700 bearing the
following fruit:
Quote:
Originally Posted by
>I have a login page which requires all users to login everytime they visit,
>the remember me feature isn't working. We all have cookies and js enabled.
IIRC the timeout was changed thus rendering the 'remember
me' feature useless, so you need to set a timeout in your
web config to get it working again.
somthing like
<authentication mode="Forms">
<forms timeout="43200"/>
</authentication
J
Quote:
Originally Posted by
>Any suggestions on how to diagnose this?
>
>My login aspx:
><asp:Login ID="Login1" runat="server" BackColor="#FFFFCC"
>BorderColor="#5400A8" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px"
>Font-Names="Verdana,Arial" Font-Size="12px" ForeColor="#333333"
>MembershipProvider="myMembershipProvider" PasswordRecoveryText="Can't
>remember your password?" PasswordRecoveryUrl="PwdRecovery.aspx"
>Height="150px" Width="245px" <TitleTextStyle BackColor="#5400A8"
>Font-Bold="True" Font-Size="14px" ForeColor="White" />
><InstructionTextStyle Font-Italic="True" ForeColor="#5400A8" />
><TextBoxStyle Font-Size="14px" />
><LoginButtonStyle Font-Names="Verdana" Font-Size="12px" ForeColor="#5400A8" />
>My web config:
<authentication mode="Forms" >
<forms name="CCAuth"
loginUrl="myLogin.aspx"
timeout="20"
slidingExpiration="true"
cookieless="AutoDetect"
protection="All"
requireSSL="false"
enableCrossAppRedirects="false"
defaultUrl="default.asp"
path="/" />
</authentication>
<membership defaultProvider="myMembershipProvider">
<providers>
<add name="myMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="myDB"
applicationName="/"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="true"
passwordFormat="Hashed"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
maxInvalidPasswordAttempts="10" />
</providers>
</membership>
Jan Hyde (VB MVP)
--
"Caring for Fine Wood" by Lindsey Doyle (David Reihmer)
Login Control Requires Response.Redirect?
with Server.Transfer or Server.Execute in mind? I am finding my Login
Control does not behave per its "ShowWhileLoggedIN" setting unless I
force some kind of client side navigation to happen.
Is it me, or the control that is broken? :-)
Happy Holidays
Please reply to brian.oneil@dotnet.itags.org.mcdean.com
( I am not finding my own posts in this forum anymore
( what happened to Search for messages by author feature? ) )Revision to this problem ; Whenever I browse to a page called
"DEFAULT", the Login Control refuses to adhere to the
"VisibleWhenLogged" property.
Any other pages on the site seem to function as expected. The Default
page has no code in it, as is the case with my other test cases. Guess
this is a throwback to the original security model where the Web.Config
handles all the Forms auth page setup?
Thanks for listening,
Brian
Login Control used with existing database
I'm creating my first 2.0 web application. I want to use the login
control to validate users using my existing SQL 2000 database (using
email address and password)
I can't find a tutuorial to do this...they always seem to want me to
create this new aspnet db and use roles and memberships and the like.
Can I simply just use my own database? I want them to login and then
fill in a session variable with their "id code", and I'll be good to
go.
thanks,
PaulOn 28 Dec 2005 08:54:35 -0800, "paulmac106" <paulmac106@.hotmail.com> wrote:
Hi,
I'm creating my first 2.0 web application. I want to use the login
control to validate users using my existing SQL 2000 database (using
email address and password)
I can't find a tutuorial to do this...they always seem to want me to
create this new aspnet db and use roles and memberships and the like.
Can I simply just use my own database? I want them to login and then
fill in a session variable with their "id code", and I'll be good to
go.
The login control operates through a Membership Provider, which uses tables in a data store, such as
SQL Server. However, it isn't designed to inter operate with SQL Server security.
Paul
~~~~
Microsoft MVP (Visual Basic)
Login Control used with existing database
I'm creating my first 2.0 web application. I want to use the login
control to validate users using my existing SQL 2000 database (using
email address and password)
I can't find a tutuorial to do this...they always seem to want me to
create this new aspnet db and use roles and memberships and the like.
Can I simply just use my own database? I want them to login and then
fill in a session variable with their "id code", and I'll be good to
go.
thanks,
PaulOn 28 Dec 2005 08:54:35 -0800, "paulmac106" <paulmac106@.hotmail.com> wrote:
Hi,
I'm creating my first 2.0 web application. I want to use the login
control to validate users using my existing SQL 2000 database (using
email address and password)
I can't find a tutuorial to do this...they always seem to want me to
create this new aspnet db and use roles and memberships and the like.
Can I simply just use my own database? I want them to login and then
fill in a session variable with their "id code", and I'll be good to
go.
The login control operates through a Membership Provider, which uses tables
in a data store, such as
SQL Server. However, it isn't designed to inter operate with SQL Server secu
rity.
Paul
~~~~
Microsoft MVP (Visual Basic)
login control validation - how use simple password?
passwords. How can I allow simple passwords, such as 6 in length with at
least 1 number?
Thanks!In your web.config inside system.web add this:
<membership>
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="false"
applicationName="/" requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="2"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership
Also, you may need to edit some details according to your database.
notice the options you have for your password strength. use it wisely!
;)
Yossi.
You can set the password regular expression in the membership element of the
web.config file. See sample below.
<membership defaultProvider="MyProvider">
<providers>
<add name="MyProvider" connectionStringName="MyDB"
applicationName="MyWebsite" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="true"
requiresUniqueEmail="false" passwordFormat="Hashed"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordStrengthRegularExpression="^[put your regex here]$"
maxInvalidPasswordAttempts="5" passwordAttemptWindow="5"
type="System.Web.Security.SqlMembershipProvider"/>
</providers>
</membership
There are some other details associated with setting up the provider that
don't come me right now. But this works for me.
Good luck,
Eagle
"VB Programmer" wrote:
> In ASP.NET 2.0, the login control seems to automatically want strong
> passwords. How can I allow simple passwords, such as 6 in length with at
> least 1 number?
> Thanks!
>
login control using SQL DB
Hi All,
I am in the process of writing an online training course, I am trying to get the login control to check a username and password against fields in an SQL database rather than using the administration site DB. I dont really know where to start. Also, as well as a username and password I would like a dropdown list that the user can select whether they are a "Delegate" or "FireWarden".
Hope this makes sense,
thanks very much everyone.
Scott.
What do you mean by Administration site DB? Do you mean the DB that the ASP.NET Configuration interface uses? If this is the case then ASP.NET by default uses SQL Server 2005 (or Express edition). You can configure it to use SQL Server 2000 also. I would suggest you use the default database for authentication purposes because it implements its own hashing to usernames and passwords, its easy to use and secure and tested (unless you are confident that you can build something more secure and rubust).
If you need more info. then let me know...
good luck...
bullpit
Hi Bullpit,
Thanks for the reply, sorry to not be very clear.
When I meant the admin db I meant the ASPNETDB.Mdf.
How customisable is the default database? Only reason I ask is that I will need to associate a user to a company.
Basically, its an online fire training course. A company will sign up, then set up its own users to take the course.
I thought that having custom databases would be easier, unless you think otherwise.
thanks very much, sorry if its a bit vague.
scott.
Its very flexible. In your case, what you can use is the Role Management feature. With this, you can create comapany users that have admin rights to the database and grant permission to create and remove child users within the company. You can Login control, Create User Wizard control to accomplish this. You can use the configuration panel to control the website and users.
If you think figuring all this out is too much work, then you can also go for your own custom database application. But if you use ASPNETDB, it already has all the relations built in. You do not have to worry about the creating the whole database application from scratch.
good luck...
bullpit
By Admin rights I mean the minimal rights that can do the work.
Hi Bullpit,
Yes I see what you are saying. I might not have explained it right: :-)
There will be 3 levels of login
1) The Owner of the training course / website (this person can see a list of ALL compaines and delegates)
2) The Firewarden (This is the firewarden for the company that will be taking the training course, this person can add, edit, delete users from the training course, only for their own company)
3) The Delegate (They are assigned a username and password by the firewarden, they can then user these to log in and take the course)
The Owner can activate / deactivate any user within any company
The Firewarden can do the same but only for their own company
The Delegate can only take the course
Does this make it a bit clearer?
This is why I thought a custom designed solution might be better.
thanks very much,
Scott.
1) The Owner of the training course / website (this person can see a list of ALL compaines and delegates) = YOU
2) The Firewarden (This is the firewarden for the company that will be taking the training course, this person can add, edit, delete users from the training course, only for their own company) = COMPANY's ADMIN USER
3) The Delegate (They are assigned a username and password by the firewarden, they can then user these to log in and take the course) = CHILD USERS.
You can add another table or a field in a table that has the company name and do the verification at login, may be provide a dropdown so that the users can choose the company they belong to and then give the rights according to the role and company they belong to.
Does this sound doable to you?
bullpit
Hi Bullpit,
Thanks very much for that, it does make sense, not quite sure where to start but it does sound doable to me.
thanks again for your help,
scott.
Hi Bullpit,.
one more thing to point out
"1) The Owner of the training course / website (this person can see a list of ALL compaines and delegates) = YOU"
This will actually be the customer that I supply the site to so they will not be using the site configuration, can they still see the list of users and companies etc?
thanks,
Scott.
Sure, anytime...I dont know which database server you are using but if you are using SQL Server 2005, it should already be configured but if you are using 2000 and need help with configuring it, let me know. And your application does need more thinking than what I have suggeted, so make a good plan and then go for it. My suggestions may not be the best ones.
good luck...
bullpit
You can actually have remote access to the Site Mangement tool.
go thru this tutorial and I believe this will help you.
http://www.sitepoint.com/article/asp-net-2-security
good luck...
bullpit
thanks very much mate, I will work through the tutorial.
And yes I am using SQL Server 2005.
thanks again for all your help.
Scott.
I am sorry but the tutorial I sent does not tell you explicitely how to use it remotely. I am looking into it and will get back to you with a good article but it is accessible remotely (documentation in MSDN). You may find my question posted in this forum soon.
good luck...
bullpit
ha ha, its ok and thanks for looking into it.
To be honest, I didnt even know that you could view the users in a gridview so that is a step forward anyway.
thanks again.
Scott.
I believe you can use these two articles to get remote access to the website admin tool.
http://weblogs.asp.net/jeffwids/archive/2005/07/26/420572.aspx
http://www.extremeexperts.com/Net/Articles/ConfigurationManagementinASPNET.aspx
bullpit
Login control using SQL database
I created a website in my computer with login controls. On testing it locally, everything worked. I copied the website through ftp to my web site host. Everything worked except the login control. I used the aspnet tool and created all the tables, views and storeprocedures in the sql server of my host. But how do I link the login control to use this database.
Thank you for the reply. Any other suggestions to do this (make login work) are also welcome.
I think what is missing is that you need to update your web.config file to point at the server where you've registered your membership tables.
This blog post walksthrough the easiest way to-do this:http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx
Hope this helps,
Scott
login control validation - how use simple password?
passwords. How can I allow simple passwords, such as 6 in length with at
least 1 number?
Thanks!In your web.config inside system.web add this:
<membership>
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="false"
applicationName="/" requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="2"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
Also, you may need to edit some details according to your database.
notice the options you have for your password strength. use it wisely!
;)
Yossi.
You can set the password regular expression in the membership element of th
e
web.config file. See sample below.
<membership defaultProvider="MyProvider">
<providers>
<add name="MyProvider" connectionStringName="MyDB"
applicationName="MyWebsite" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="true"
requiresUniqueEmail="false" passwordFormat="Hashed"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordStrengthRegularExpression="^[put your regex here]$"
maxInvalidPasswordAttempts="5" passwordAttemptWindow="5"
type="System.Web.Security.SqlMembershipProvider"/>
</providers>
</membership>
There are some other details associated with setting up the provider that
don't come me right now. But this works for me.
Good luck,
Eagle
"VB Programmer" wrote:
> In ASP.NET 2.0, the login control seems to automatically want strong
> passwords. How can I allow simple passwords, such as 6 in length with at
> least 1 number?
> Thanks!
>
>
Login control with default role, and additional fields?
Please advise before I lose my mind.A full example in VB would keep my sanity (maybe its to late...brrrr-looo-hiiiii-haaaa-hoo-brrrrr)
I am a Newbe never programmed before. Its several hints and examples out there but I still don't get it.
My questing is:
- How to add a default role, "User_basic", for the users creating a new user account (I don't want the user to be able to select a role with a listbox)
- How to save the "First name" (additional field in the control) to my table.
The first thing I do is to create a "Create user step" for my site.
Using the CreateUSerWizard, in the default first step containing the "User name", "Password" etc I have added a new field "First name:" (I am trying to get all my fields in the same step) I also have made a new table (user_info) in my db. This table has 2 columns, UserId and FirsName.
My code so far:
***VB***
PartialClass CreateNewLogUser
Inherits System.Web.UI.Page
ProtectedSub DeactiveStep(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles CreateUserWizard1.CreatedUser
'HOW DO I SAVE THE DEFAULT ROLE (user_basic) FOR THE USER BEFORE THIS STEP (this step is run after the user is created. Or what…???)
'....Role.UserId = "User_basic"....
Dim FirstNameAs TextBox
FirstName = CreateUserWizard1.FindControl("FirstName")
' Todo: Store the FirstNAme to the DB
EndSub
EndClass
***GUI***
<asp:CreateUserWizardID="CreateUserWizard1"runat="server"BackColor="#F7F6F3"BorderColor="#E6E2D8"
BorderStyle="Solid"BorderWidth="1px"Font-Names="Verdana"Font-Size="0.8em">
<WizardSteps>
<asp:CreateUserWizardSteprunat="server">
<ContentTemplate>
<tableborder="0"style="font-size: 100%; font-family: Verdana">
<tr>
<tdalign="center"colspan="2"style="font-weight: bold; color: white; background-color: #5d7b9d">
Sign Up for Your New Account</td>
</tr>
<tr>
<tdalign="right">
<asp:LabelID="UserNameLabel"runat="server"AssociatedControlID="UserName">User Name:</asp:Label></td>
<td>
<asp:TextBoxID="UserName"runat="server"></asp:TextBox>
<asp:RequiredFieldValidatorID="UserNameRequired"runat="server"ControlToValidate="UserName"
ErrorMessage="User Name is required."ToolTip="User Name is required."ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<tdalign="right">
<asp:LabelID="PasswordLabel"runat="server"AssociatedControlID="Password">Password:</asp:Label></td>
<td>
<asp:TextBoxID="Password"runat="server"TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidatorID="PasswordRequired"runat="server"ControlToValidate="Password"
ErrorMessage="Password is required."ToolTip="Password is required."ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<tdalign="right">
<asp:LabelID="ConfirmPasswordLabel"runat="server"AssociatedControlID="ConfirmPassword">Confirm Password:</asp:Label></td>
<td>
<asp:TextBoxID="ConfirmPassword"runat="server"TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidatorID="ConfirmPasswordRequired"runat="server"ControlToValidate="ConfirmPassword"
ErrorMessage="Confirm Password is required."ToolTip="Confirm Password is required."
ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<tdalign="right">
<asp:LabelID="EmailLabel"runat="server"AssociatedControlID="Email">E-mail:</asp:Label></td>
<td>
<asp:TextBoxID="Email"runat="server"></asp:TextBox>
<asp:RequiredFieldValidatorID="EmailRequired"runat="server"ControlToValidate="Email"
ErrorMessage="E-mail is required."ToolTip="E-mail is required."ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<tdalign="right">
<asp:LabelID="QuestionLabel"runat="server"AssociatedControlID="Question">Security Question:</asp:Label></td>
<td>
<asp:TextBoxID="Question"runat="server"></asp:TextBox>
<asp:RequiredFieldValidatorID="QuestionRequired"runat="server"ControlToValidate="Question"
ErrorMessage="Security question is required."ToolTip="Security question is required."
ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<tdalign="right">
<asp:LabelID="AnswerLabel"runat="server"AssociatedControlID="Answer">Security Answer:</asp:Label></td>
<td>
<asp:TextBoxID="Answer"runat="server"></asp:TextBox>
<asp:RequiredFieldValidatorID="AnswerRequired"runat="server"ControlToValidate="Answer"
ErrorMessage="Security answer is required."ToolTip="Security answer is required."
ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<tdalign="right">
First name:</td>
<td>
<asp:TextBoxID="FirstNameTextBox"runat="server"></asp:TextBox></td>
</tr>
<tr>
<tdalign="center"colspan="2">
<asp:CompareValidatorID="PasswordCompare"runat="server"ControlToCompare="Password"
ControlToValidate="ConfirmPassword"Display="Dynamic"ErrorMessage="The Password and Confirmation Password must match."
ValidationGroup="CreateUserWizard1"></asp:CompareValidator>
</td>
</tr>
<tr>
<tdalign="center"colspan="2"style="color: red">
<asp:LiteralID="ErrorMessage"runat="server"EnableViewState="False"></asp:Literal>
</td>
</tr>
</table>
</ContentTemplate>
</asp:CreateUserWizardStep>
<asp:CompleteWizardSteprunat="server">
</asp:CompleteWizardStep>
</WizardSteps>
<SideBarStyleBackColor="#5D7B9D"BorderWidth="0px"Font-Size="0.9em"VerticalAlign="Top"/>
<TitleTextStyleBackColor="#5D7B9D"Font-Bold="True"ForeColor="White"/>
<SideBarButtonStyleBorderWidth="0px"Font-Names="Verdana"ForeColor="White"/>
<NavigationButtonStyleBackColor="#FFFBFF"BorderColor="#CCCCCC"BorderStyle="Solid"
BorderWidth="1px"Font-Names="Verdana"ForeColor="#284775"/>
<HeaderStyleBackColor="#5D7B9D"BorderStyle="Solid"Font-Bold="True"Font-Size="0.9em"
ForeColor="White"HorizontalAlign="Center"/>
<CreateUserButtonStyleBackColor="#FFFBFF"BorderColor="#CCCCCC"BorderStyle="Solid"
BorderWidth="1px"Font-Names="Verdana"ForeColor="#284775"/>
<ContinueButtonStyleBackColor="#FFFBFF"BorderColor="#CCCCCC"BorderStyle="Solid"
BorderWidth="1px"Font-Names="Verdana"ForeColor="#284775"/>
<StepStyleBorderWidth="0px"/>
</asp:CreateUserWizard>
Firstly to add a default role to the new account, add some code along the lines of
Protected Sub CreateUserWizard1_CreatedUser(ByVal senderAs Object,ByVal eAs System.EventArgs) Roles.AddUserToRole(CreateUserWizard1.UserName,"User_basic")End Sub
Then to save the other fields you need to look at profiles. This site might help you get started.
http://aspnet.4guysfromrolla.com/articles/120705-1.aspx
Hope this gets you started
Jeremy
Hi, I am nearly there. But I am getting this error:
No mapping exists from object type System.Web.UI.WebControls.TextBox to a known managed provider native type.
Exception Details:System.ArgumentException: No mapping exists from object type System.Web.UI.WebControls.TextBox to a known managed provider native type
Line 26: Using conLine 27: con.Open()Line 28: cmd.ExecuteNonQuery()Line 29: End UsingLine 30: End Sub
Here is my code in the .aspx.vb-file:
*************************************************'
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports System.Collections.Generic
PartialClass CreateNewLogUser
Inherits System.Web.UI.Page
Dim FirstNameAs TextBox =CType(CreateUserWizardStep0.ContentTemplateContainer.FindControl("FirstNameTextBox"), TextBox)
Dim LastNameAs TextBox =CType(CreateUserWizardStep0.ContentTemplateContainer.FindControl("FirstNameTextBox"), TextBox)
Dim UserNameTextBoxAs TextBox =CType(CreateUserWizardStep0.ContentTemplateContainer.FindControl("UserName"), TextBox)
Dim UserAs MembershipUser = Membership.GetUser(UserNameTextBox.Text)
Dim UserIDAsObject = User.ProviderUserKey
Dim conStringAsString = WebConfigurationManager.ConnectionStrings("MyConnectionString1").ConnectionString
Dim conAsNew SqlConnection(conString)
Dim cmdAsNew SqlCommand("INSERT LogUser_Personal_info ( UserId, FirstName, LastName ) VALUES ( @.UserId, @.FirstName,@.LastName )", con)
cmd.Parameters.AddWithValue("@.UserID", UserID)
cmd.Parameters.AddWithValue("@.FirstName", FirstName)
cmd.Parameters.AddWithValue("@.LastName", LastName)
Using con
con.Open()
cmd.ExecuteNonQuery()
EndUsingEndSub
End
Class*******************************************************************
Here from my web.config- file:
<
connectionStrings><addname="MyConnectionString1"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
*****************************************************************
Please advise.
Login control with Oracle possible?
I'm migrating a perl with Oracle website to a .net with Oracle website. Is it possible to get the login control to work with an Oracle database where I specify where the login information is held?
I'd rather not reinvent the wheel by writing my whole login/authentication script by hand.
Thanks!
Yes you can. The .NET Framework has a built in Provider for oracle. In the login control, simply put your authentication logic in the OnAuthenticate event of the login control.
You can use this Membership Provider for oraclehttp://www.crlab.com/oranet/
Yes that is possible as well, however I assumed that he has an already existing database with all of the users in them.
jhilden:
I'm migrating a perl with Oracle website to a .net with Oracle website. Is it possible to get the login control to work with an Oracle database where I specify where the login information is held?
I'd rather not reinvent the wheel by writing my whole login/authentication script by hand.
Thanks!
There is Oracle provider code for 10g RC2 in both C# and VB provided by other developers, you could check them out it helps if you are running XP and above with at least 1gig of ram. If you are running 9i and below then check out the link provided by Albert Corelab sells third party drivers to most RDBMS(relational database management systems), another vendor is Datadirect these drivers a usually better than the generic free ones provided by Microsoft or Oracle. These should get you started. Hope this helps.
http://www.radicaldevelopment.net/Projects/OracleProviders.aspx
http://www.ben-rush.net/source/OracleProviders/
vcsjones:
Yes you can. The .NET Framework has a built in Provider for oracle. In the login control, simply put your authentication logic in the OnAuthenticate event of the login control.
double clicking on the login object created the methodprotected void Login1_Authenticate(object sender, AuthenticateEventArgs e), I just dropped the custom code into there and sete.Authenticated = true; when the user sucessfully authenticated.
Thanks everyone!
Login Control!
the page I offer a signup link thru which a user can create an account. I
want the user to be redirected to the page on which he working when he
clicked up the signup link (which is create account wizard page )
How to accomplish this?
I know the request.REferealURl etc...API's but don't know where in the
create account wizard I shud place this?
TIAHi,
when someone tries to access your secured page, the most probale way you
would be using is on Page_Load you would check if his session value is not
null, in case it is you will redirect him to the login page with appropiate
message. What you can do here is, you can pass the url of the page he has
got redirected from to the login as querystring, and after proper validation
you can redirect him back to that page as you would have the URL,...e.g:-
in your page_load, you would write..........
if (Session["LoginStatus"] == null){
Response.Redirect("UserLogIn.aspx?rurl=" +
Server.HtmlEncode(Page.AppRelativeVirtualPath));
}
and in your login page, after validation.....
if (username and password id valid logic) {
Response.Redirect(Request.QueryString["rurl"].toString());
}
Hope this helps.
Rgds,
Bhaskar
"Vai2000" <nospam@.microsoft.comwrote in message
news:OH%23XRCfSHHA.3500@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
Hi All, I have a website which allows users to visit anonymously.
Throughout
the page I offer a signup link thru which a user can create an account. I
want the user to be redirected to the page on which he working when he
clicked up the signup link (which is create account wizard page )
How to accomplish this?
>
I know the request.REferealURl etc...API's but don't know where in the
create account wizard I shud place this?
>
TIA
>
>
Thanks, though was looking for some out of the box functionality in asp.net
2.0
"Bhaskardeep Khaund" <bhaskardeep@.rediffmail.comwrote in message
news:uYH9lifSHHA.5016@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
Hi,
>
when someone tries to access your secured page, the most probale way you
would be using is on Page_Load you would check if his session value is not
null, in case it is you will redirect him to the login page with
appropiate
Quote:
Originally Posted by
message. What you can do here is, you can pass the url of the page he has
got redirected from to the login as querystring, and after proper
validation
Quote:
Originally Posted by
you can redirect him back to that page as you would have the URL,...e.g:-
>
in your page_load, you would write..........
>
if (Session["LoginStatus"] == null){
Response.Redirect("UserLogIn.aspx?rurl=" +
Server.HtmlEncode(Page.AppRelativeVirtualPath));
}
>
>
and in your login page, after validation.....
>
if (username and password id valid logic) {
Response.Redirect(Request.QueryString["rurl"].toString());
}
>
Hope this helps.
>
Rgds,
Bhaskar
>
>
>
>
"Vai2000" <nospam@.microsoft.comwrote in message
news:OH%23XRCfSHHA.3500@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
Hi All, I have a website which allows users to visit anonymously.
Throughout
the page I offer a signup link thru which a user can create an account.
I
Quote:
Originally Posted by
Quote:
Originally Posted by
want the user to be redirected to the page on which he working when he
clicked up the signup link (which is create account wizard page )
How to accomplish this?
I know the request.REferealURl etc...API's but don't know where in the
create account wizard I shud place this?
TIA
>
>
Login Control!
I want just 3 users who can login to the system to perform some tasks...
Questions:
1 .Can an ASP Application have individual page level access? if my app has
10 pages I want 7 pages to be public and 3 pages to have security access? If
so how can I accomplish it?
2. Can I have the user ID and passwords stored in the web.config? if so
please tell me how to integrate with the login control & store it in
web.config ? also how can I safeguard it against hacking (encoding?)
Thanks a bunch!> 1 .Can an ASP Application have individual page level access? if my app
> has
> 10 pages I want 7 pages to be public and 3 pages to have security
> access? If
> so how can I accomplish it?
Use the <location path='page1.aspx'>...</location> element. Check MSDN for
specifics.
> 2. Can I have the user ID and passwords stored in the web.config? if
> so
> please tell me how to integrate with the login control & store it in
> web.config ? also how can I safeguard it against hacking (encoding?)
Check the docs for the <forms> element in web.config. Also, Dom wrote a membership
provider for this:
http://www.leastprivilege.com/ASPNE...nfig2ndTry.aspx
-Brock
http://staff.develop.com/ballen
Login control, can I get more fields into it?
Hello All:
I have used the Create new user control, I want to add more fields and store them in the aspnet_Users table. I would love the standard Name, Address, City, Zip fields. I tried adding to the aspnet_User table in Database Explorer. I got the fields to show up in the explorer, but when I drop a SqlDataSource on a page I cant seem to get the fields I have added to show. AM I supposed to store these values in another table? It seems like data that should go in a user table. I just want simple address fileds. Its very fustrating.
Sincerly,
Very Confused Newbie
I don't really know if there is another way to do it, and there probably is, but I created a wizard control for new users to create an account. For the additional columns for address, e-mail information, etc, I created a separate table in my database called UserAdditional where the primary key is the user's id. I then created the SQLDataSource to point to that database for those additional fields.
I hope this helps.
Check below two links
Gathering Custom User Registration Information
Customizing the CreateUserWizard Control
HC
Hey Haissam thanks alot those sites were very helpful. You rock!
Login Control!
I want just 3 users who can login to the system to perform some tasks...
Questions:
1 .Can an ASP Application have individual page level access? if my app has
10 pages I want 7 pages to be public and 3 pages to have security access? If
so how can I accomplish it?
2. Can I have the user ID and passwords stored in the web.config? if so
please tell me how to integrate with the login control & store it in
web.config ? also how can I safeguard it against hacking (encoding?)
Thanks a bunch!> 1 .Can an ASP Application have individual page level access? if my app
> has
> 10 pages I want 7 pages to be public and 3 pages to have security
> access? If
> so how can I accomplish it?
Use the <location path='page1.aspx'>...</location> element. Check MSDN for
specifics.
> 2. Can I have the user ID and passwords stored in the web.config? if
> so
> please tell me how to integrate with the login control & store it in
> web.config ? also how can I safeguard it against hacking (encoding?)
Check the docs for the <forms> element in web.config. Also, Dom wrote a memb
ership
provider for this:
http://www.leastprivilege.com/ ASPN...elop.com/ballen
Login Control!
the page I offer a signup link thru which a user can create an account. I
want the user to be redirected to the page on which he working when he
clicked up the signup link (which is create account wizard page )
How to accomplish this?
I know the request.REferealURl etc...API's but don't know where in the
create account wizard I shud place this?
TIAHi,
when someone tries to access your secured page, the most probale way you
would be using is on Page_Load you would check if his session value is not
null, in case it is you will redirect him to the login page with appropiate
message. What you can do here is, you can pass the url of the page he has
got redirected from to the login as querystring, and after proper validation
you can redirect him back to that page as you would have the URL,...e.g:-
in your page_load, you would write..........
if (Session["LoginStatus"] == null){
Response.Redirect("UserLogIn.aspx?rurl=" +
Server.HtmlEncode(Page.AppRelativeVirtualPath));
}
and in your login page, after validation.....
if (username and password id valid logic) {
Response.Redirect(Request.QueryString["rurl"].toString());
}
Hope this helps.
Rgds,
Bhaskar
"Vai2000" <nospam@.microsoft.com> wrote in message
news:OH%23XRCfSHHA.3500@.TK2MSFTNGP05.phx.gbl...
> Hi All, I have a website which allows users to visit anonymously.
> Throughout
> the page I offer a signup link thru which a user can create an account. I
> want the user to be redirected to the page on which he working when he
> clicked up the signup link (which is create account wizard page )
> How to accomplish this?
> I know the request.REferealURl etc...API's but don't know where in the
> create account wizard I shud place this?
> TIA
>
Thanks, though was looking for some out of the box functionality in asp.net
2.0
"Bhaskardeep Khaund" <bhaskardeep@.rediffmail.com> wrote in message
news:uYH9lifSHHA.5016@.TK2MSFTNGP05.phx.gbl...
> Hi,
> when someone tries to access your secured page, the most probale way you
> would be using is on Page_Load you would check if his session value is not
> null, in case it is you will redirect him to the login page with
appropiate
> message. What you can do here is, you can pass the url of the page he has
> got redirected from to the login as querystring, and after proper
validation
> you can redirect him back to that page as you would have the URL,...e.g:-
> in your page_load, you would write..........
> if (Session["LoginStatus"] == null){
> Response.Redirect("UserLogIn.aspx?rurl=" +
> Server.HtmlEncode(Page.AppRelativeVirtualPath));
> }
>
> and in your login page, after validation.....
> if (username and password id valid logic) {
> Response.Redirect(Request.QueryString["rurl"].toString());
> }
> Hope this helps.
> Rgds,
> Bhaskar
>
>
> "Vai2000" <nospam@.microsoft.com> wrote in message
> news:OH%23XRCfSHHA.3500@.TK2MSFTNGP05.phx.gbl...
I
>
Login Control/Validation Summary within Content Placeholder
I have a web app with a simple master page that contains just one
content placeholder.
I have created a web form that then uses this master page. Within the
content placeholder, I have placed a Login control (Login1) and a
ValidationSummary control.
I have set the ValidationSummary's ValidationGroup property equal to
"Login1".
The problem:
The validation summary is not firing when a login textbox is left
blank.
What I have found:
I put the Login control and ValidationSummary control in a separate
page that uses no masterpage/content placeholders - and it works fine.
So it seems the issue begins with the master page/content involvement.
I looked at the HTML source on both pages and this throws up what I
think is causing the problem - but I'm not sure how to resolve it!
In the non-master page file, you get the following markup:
<script type="text/javascript">
<!--
var Login1_UserNameRequired = document.all ?
document.all["Login1_UserNameRequired"] :
document.getElementById("Login1_UserNameRequired");
Login1_UserNameRequired.controltovalidate = "Login1_UserName";
Login1_UserNameRequired.errormessage = "User Name is required.";
Login1_UserNameRequired.validationGroup = "Login1";
Login1_UserNameRequired.evaluationfunction =
"RequiredFieldValidatorEvaluateIsValid";
Login1_UserNameRequired.initialvalue = "";
var Login1_PasswordRequired = document.all ?
document.all["Login1_PasswordRequired"] :
document.getElementById("Login1_PasswordRequired");
Login1_PasswordRequired.controltovalidate = "Login1_Password";
Login1_PasswordRequired.errormessage = "Password is required.";
Login1_PasswordRequired.validationGroup = "Login1";
Login1_PasswordRequired.evaluationfunction =
"RequiredFieldValidatorEvaluateIsValid";
Login1_PasswordRequired.initialvalue = "";
var ValidationSummary1 = document.all ?
document.all["ValidationSummary1"] :
document.getElementById("ValidationSummary1");
ValidationSummary1.validationGroup = "Login1";
// -->
</script>
However, when I use the master page code, you get:
<script type="text/javascript">
<!--
var ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired = document.all ?
document.all[" ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired"] :
document.getElementById(" ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired")
;
ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired.controltovalidate =
" ctl00_ContentPlaceHolder1_Login1_UserNam
e";
ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired.errormessage = "User
Name is required.";
ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired.validationGroup =
"ctl00$ContentPlaceHolder1$Login1";
ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired.evaluationfunction =
"RequiredFieldValidatorEvaluateIsValid";
ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired.initialvalue = "";
var ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired = document.all ?
document.all[" ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired"] :
document.getElementById(" ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired")
;
ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired.controltovalidate =
" ctl00_ContentPlaceHolder1_Login1_Passwor
d";
ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired.errormessage =
"Password is required.";
ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired.validationGroup =
"ctl00$ContentPlaceHolder1$Login1";
ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired.evaluationfunction =
"RequiredFieldValidatorEvaluateIsValid";
ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired.initialvalue = "";
var ctl00_ContentPlaceHolder1_ValidationSumm
ary1 = document.all ?
document.all[" ctl00_ContentPlaceHolder1_ValidationSumm
ary1"] :
document.getElementById(" ctl00_ContentPlaceHolder1_ValidationSumm
ary1");
ctl00_ContentPlaceHolder1_ValidationSumm
ary1.validationGroup =
"ContentPlaceHolder1.Login1";
// -->
</script>
It seems that the ValidationGroup for the internal controls of the
Login control has been changed from "Login1" to
"ctl00$ContentPlaceHolder1$Login1" causing a mis-match between the
Login control and ValidationSummary.
Is there a way of rectifying this?
Many thanks in hope of a reply!!
Ianilockett,
Error you are adding validation to the login control that does its own
validation. You have your design backwards or are doing something wrong.
Good Luck finding your error.
DWS
"ilockett" wrote:
> The background:
> I have a web app with a simple master page that contains just one
> content placeholder.
> I have created a web form that then uses this master page. Within the
> content placeholder, I have placed a Login control (Login1) and a
> ValidationSummary control.
> I have set the ValidationSummary's ValidationGroup property equal to
> "Login1".
> The problem:
> The validation summary is not firing when a login textbox is left
> blank.
> What I have found:
> I put the Login control and ValidationSummary control in a separate
> page that uses no masterpage/content placeholders - and it works fine.
> So it seems the issue begins with the master page/content involvement.
> I looked at the HTML source on both pages and this throws up what I
> think is causing the problem - but I'm not sure how to resolve it!
> In the non-master page file, you get the following markup:
> <script type="text/javascript">
> <!--
> var Login1_UserNameRequired = document.all ?
> document.all["Login1_UserNameRequired"] :
> document.getElementById("Login1_UserNameRequired");
> Login1_UserNameRequired.controltovalidate = "Login1_UserName";
> Login1_UserNameRequired.errormessage = "User Name is required.";
> Login1_UserNameRequired.validationGroup = "Login1";
> Login1_UserNameRequired.evaluationfunction =
> "RequiredFieldValidatorEvaluateIsValid";
> Login1_UserNameRequired.initialvalue = "";
> var Login1_PasswordRequired = document.all ?
> document.all["Login1_PasswordRequired"] :
> document.getElementById("Login1_PasswordRequired");
> Login1_PasswordRequired.controltovalidate = "Login1_Password";
> Login1_PasswordRequired.errormessage = "Password is required.";
> Login1_PasswordRequired.validationGroup = "Login1";
> Login1_PasswordRequired.evaluationfunction =
> "RequiredFieldValidatorEvaluateIsValid";
> Login1_PasswordRequired.initialvalue = "";
> var ValidationSummary1 = document.all ?
> document.all["ValidationSummary1"] :
> document.getElementById("ValidationSummary1");
> ValidationSummary1.validationGroup = "Login1";
> // -->
> </script>
> However, when I use the master page code, you get:
> <script type="text/javascript">
> <!--
> var ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired = document.all ?
> document.all[" ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired"] :
> document.getElementById(" ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired
");
> ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired.controltovalidate =
> " ctl00_ContentPlaceHolder1_Login1_UserNam
e";
> ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired.errormessage = "User
> Name is required.";
> ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired.validationGroup =
> "ctl00$ContentPlaceHolder1$Login1";
> ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired.evaluationfunction =
> "RequiredFieldValidatorEvaluateIsValid";
> ctl00_ContentPlaceHolder1_Login1_UserNam
eRequired.initialvalue = "";
> var ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired = document.all ?
> document.all[" ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired"] :
> document.getElementById(" ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired
");
> ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired.controltovalidate =
> " ctl00_ContentPlaceHolder1_Login1_Passwor
d";
> ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired.errormessage =
> "Password is required.";
> ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired.validationGroup =
> "ctl00$ContentPlaceHolder1$Login1";
> ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired.evaluationfunction =
> "RequiredFieldValidatorEvaluateIsValid";
> ctl00_ContentPlaceHolder1_Login1_Passwor
dRequired.initialvalue = "";
> var ctl00_ContentPlaceHolder1_ValidationSumm
ary1 = document.all ?
> document.all[" ctl00_ContentPlaceHolder1_ValidationSumm
ary1"] :
> document.getElementById(" ctl00_ContentPlaceHolder1_ValidationSumm
ary1");
> ctl00_ContentPlaceHolder1_ValidationSumm
ary1.validationGroup =
> "ContentPlaceHolder1.Login1";
> // -->
> </script>
> It seems that the ValidationGroup for the internal controls of the
> Login control has been changed from "Login1" to
> "ctl00$ContentPlaceHolder1$Login1" causing a mis-match between the
> Login control and ValidationSummary.
> Is there a way of rectifying this?
> Many thanks in hope of a reply!!
> Ian
>
DWS
Thanks for taking the time to reply.
Whilst the Login control does have it's own validation - it only
displays the asterisk after the textbox and does not actually display a
message. This could be missed by some users.
I was hoping that the validation summary would show the error in a more
explicit way. I don't feel I am doing anything wrong - the
combination of Login and ValidationSummary works fine when not used
within a Content Placeholder.
I have so far worked around it by using the FindControl method:
Dim myLogin As Login
Dim mySummary As ValidationSummary
myLogin =
[LoginViewControlName].FindControl("[LoginControlName]")
mySummary =
[LoginViewControlName].FindControl("[ValidationSummaryControlName")
If myLogin IsNot Nothing Then
' Replace the returned underscores with dollar signs.
mySummary.ValidationGroup = Replace(myLogin.ClientID, "_",
"$")
End If
However, I'm really not happy in having to do it this way, and so any
other suggestions are more than welcome.
Many thanks
Ian
Ian,
I was having the same problem last night. It frustrated me for a good two
hours and I still have no fix. Glad to see that it's a problem with the
Master Pages, that was what I was going to try to test this time around... I
will probably end up using your workaround for now. If I come up with
something else I will let you know.
Dan
"ilockett" wrote:
> DWS
> Thanks for taking the time to reply.
> Whilst the Login control does have it's own validation - it only
> displays the asterisk after the textbox and does not actually display a
> message. This could be missed by some users.
> I was hoping that the validation summary would show the error in a more
> explicit way. I don't feel I am doing anything wrong - the
> combination of Login and ValidationSummary works fine when not used
> within a Content Placeholder.
> I have so far worked around it by using the FindControl method:
> Dim myLogin As Login
> Dim mySummary As ValidationSummary
> myLogin =
> [LoginViewControlName].FindControl("[LoginControlName]")
> mySummary =
> [LoginViewControlName].FindControl("[ValidationSummaryControlName")
> If myLogin IsNot Nothing Then
> ' Replace the returned underscores with dollar signs.
> mySummary.ValidationGroup = Replace(myLogin.ClientID, "_",
> "$")
> End If
> However, I'm really not happy in having to do it this way, and so any
> other suggestions are more than welcome.
> Many thanks
> Ian
>
A simpler workaround is to put a procedure like this in the content page:
Private Sub LinkLoginToValidationSummary(ByVal sender As Object, ByVal e As
EventArgs) Handles MainLogin.PreRender
ValSum.ValidationGroup = MainLogin.UniqueID
End Sub
In this example, "MainLogin" is the ID of the login control and "ValSum" is
the ID of the validation summary control.
Cheers,
Andrew Zalotocky
quote:
Originally posted by ilockett
DWS
Thanks for taking the time to reply.
Whilst the Login control does have it's own validation - it only
displays the asterisk after the textbox and does not actually display a
message. This could be missed by some users.
I was hoping that the validation summary would show the error in a more
explicit way. I don't feel I am doing anything wrong - the
combination of Login and ValidationSummary works fine when not used
within a Content Placeholder.
I have so far worked around it by using the FindControl method:
Dim myLogin As Login
Dim mySummary As ValidationSummary
myLogin =
[LoginViewControlName].FindControl("[LoginControlName]")
mySummary =
[LoginViewControlName].FindControl("[ValidationSummaryControlName")
If myLogin IsNot Nothing Then
' Replace the returned underscores with dollar signs.
mySummary.ValidationGroup = Replace(myLogin.ClientID, "_",
"$")
End If
However, I'm really not happy in having to do it this way, and so any
other suggestions are more than welcome.
Many thanks
Ian
Login Control/Validation Summary within Content Placeholder
I have a web app with a simple master page that contains just one
content placeholder.
I have created a web form that then uses this master page. Within the
content placeholder, I have placed a Login control (Login1) and a
ValidationSummary control.
I have set the ValidationSummary's ValidationGroup property equal to
"Login1".
The problem:
The validation summary is not firing when a login textbox is left
blank.
What I have found:
I put the Login control and ValidationSummary control in a separate
page that uses no masterpage/content placeholders - and it works fine.
So it seems the issue begins with the master page/content involvement.
I looked at the HTML source on both pages and this throws up what I
think is causing the problem - but I'm not sure how to resolve it!
In the non-master page file, you get the following markup:
<script type="text/javascript">
<!--
var Login1_UserNameRequired = document.all ?
document.all["Login1_UserNameRequired"] :
document.getElementById("Login1_UserNameRequired");
Login1_UserNameRequired.controltovalidate = "Login1_UserName";
Login1_UserNameRequired.errormessage = "User Name is required.";
Login1_UserNameRequired.validationGroup = "Login1";
Login1_UserNameRequired.evaluationfunction =
"RequiredFieldValidatorEvaluateIsValid";
Login1_UserNameRequired.initialvalue = "";
var Login1_PasswordRequired = document.all ?
document.all["Login1_PasswordRequired"] :
document.getElementById("Login1_PasswordRequired");
Login1_PasswordRequired.controltovalidate = "Login1_Password";
Login1_PasswordRequired.errormessage = "Password is required.";
Login1_PasswordRequired.validationGroup = "Login1";
Login1_PasswordRequired.evaluationfunction =
"RequiredFieldValidatorEvaluateIsValid";
Login1_PasswordRequired.initialvalue = "";
var ValidationSummary1 = document.all ?
document.all["ValidationSummary1"] :
document.getElementById("ValidationSummary1");
ValidationSummary1.validationGroup = "Login1";
// -->
</script
However, when I use the master page code, you get:
<script type="text/javascript">
<!--
var ctl00_ContentPlaceHolder1_Login1_UserNameRequired = document.all ?
document.all["ctl00_ContentPlaceHolder1_Login1_UserNameRequired"] :
document.getElementById("ctl00_ContentPlaceHolder1_Login1_UserNameRequired");
ctl00_ContentPlaceHolder1_Login1_UserNameRequired. controltovalidate =
"ctl00_ContentPlaceHolder1_Login1_UserName";
ctl00_ContentPlaceHolder1_Login1_UserNameRequired. errormessage = "User
Name is required.";
ctl00_ContentPlaceHolder1_Login1_UserNameRequired. validationGroup =
"ctl00$ContentPlaceHolder1$Login1";
ctl00_ContentPlaceHolder1_Login1_UserNameRequired. evaluationfunction =
"RequiredFieldValidatorEvaluateIsValid";
ctl00_ContentPlaceHolder1_Login1_UserNameRequired. initialvalue = "";
var ctl00_ContentPlaceHolder1_Login1_PasswordRequired = document.all ?
document.all["ctl00_ContentPlaceHolder1_Login1_PasswordRequired"] :
document.getElementById("ctl00_ContentPlaceHolder1_Login1_PasswordRequired");
ctl00_ContentPlaceHolder1_Login1_PasswordRequired. controltovalidate =
"ctl00_ContentPlaceHolder1_Login1_Password";
ctl00_ContentPlaceHolder1_Login1_PasswordRequired. errormessage =
"Password is required.";
ctl00_ContentPlaceHolder1_Login1_PasswordRequired. validationGroup =
"ctl00$ContentPlaceHolder1$Login1";
ctl00_ContentPlaceHolder1_Login1_PasswordRequired. evaluationfunction =
"RequiredFieldValidatorEvaluateIsValid";
ctl00_ContentPlaceHolder1_Login1_PasswordRequired. initialvalue = "";
var ctl00_ContentPlaceHolder1_ValidationSummary1 = document.all ?
document.all["ctl00_ContentPlaceHolder1_ValidationSummary1"] :
document.getElementById("ctl00_ContentPlaceHolder1_ValidationSummary1");
ctl00_ContentPlaceHolder1_ValidationSummary1.valid ationGroup =
"ContentPlaceHolder1.Login1";
// -->
</script
It seems that the ValidationGroup for the internal controls of the
Login control has been changed from "Login1" to
"ctl00$ContentPlaceHolder1$Login1" causing a mis-match between the
Login control and ValidationSummary.
Is there a way of rectifying this?
Many thanks in hope of a reply!!
Ianilockett,
Error you are adding validation to the login control that does its own
validation. You have your design backwards or are doing something wrong.
Good Luck finding your error.
DWS
"ilockett" wrote:
> The background:
> I have a web app with a simple master page that contains just one
> content placeholder.
> I have created a web form that then uses this master page. Within the
> content placeholder, I have placed a Login control (Login1) and a
> ValidationSummary control.
> I have set the ValidationSummary's ValidationGroup property equal to
> "Login1".
> The problem:
> The validation summary is not firing when a login textbox is left
> blank.
> What I have found:
> I put the Login control and ValidationSummary control in a separate
> page that uses no masterpage/content placeholders - and it works fine.
> So it seems the issue begins with the master page/content involvement.
> I looked at the HTML source on both pages and this throws up what I
> think is causing the problem - but I'm not sure how to resolve it!
> In the non-master page file, you get the following markup:
> <script type="text/javascript">
> <!--
> var Login1_UserNameRequired = document.all ?
> document.all["Login1_UserNameRequired"] :
> document.getElementById("Login1_UserNameRequired");
> Login1_UserNameRequired.controltovalidate = "Login1_UserName";
> Login1_UserNameRequired.errormessage = "User Name is required.";
> Login1_UserNameRequired.validationGroup = "Login1";
> Login1_UserNameRequired.evaluationfunction =
> "RequiredFieldValidatorEvaluateIsValid";
> Login1_UserNameRequired.initialvalue = "";
> var Login1_PasswordRequired = document.all ?
> document.all["Login1_PasswordRequired"] :
> document.getElementById("Login1_PasswordRequired");
> Login1_PasswordRequired.controltovalidate = "Login1_Password";
> Login1_PasswordRequired.errormessage = "Password is required.";
> Login1_PasswordRequired.validationGroup = "Login1";
> Login1_PasswordRequired.evaluationfunction =
> "RequiredFieldValidatorEvaluateIsValid";
> Login1_PasswordRequired.initialvalue = "";
> var ValidationSummary1 = document.all ?
> document.all["ValidationSummary1"] :
> document.getElementById("ValidationSummary1");
> ValidationSummary1.validationGroup = "Login1";
> // -->
> </script>
> However, when I use the master page code, you get:
> <script type="text/javascript">
> <!--
> var ctl00_ContentPlaceHolder1_Login1_UserNameRequired = document.all ?
> document.all["ctl00_ContentPlaceHolder1_Login1_UserNameRequired"] :
> document.getElementById("ctl00_ContentPlaceHolder1_Login1_UserNameRequired");
> ctl00_ContentPlaceHolder1_Login1_UserNameRequired. controltovalidate =
> "ctl00_ContentPlaceHolder1_Login1_UserName";
> ctl00_ContentPlaceHolder1_Login1_UserNameRequired. errormessage = "User
> Name is required.";
> ctl00_ContentPlaceHolder1_Login1_UserNameRequired. validationGroup =
> "ctl00$ContentPlaceHolder1$Login1";
> ctl00_ContentPlaceHolder1_Login1_UserNameRequired. evaluationfunction =
> "RequiredFieldValidatorEvaluateIsValid";
> ctl00_ContentPlaceHolder1_Login1_UserNameRequired. initialvalue = "";
> var ctl00_ContentPlaceHolder1_Login1_PasswordRequired = document.all ?
> document.all["ctl00_ContentPlaceHolder1_Login1_PasswordRequired"] :
> document.getElementById("ctl00_ContentPlaceHolder1_Login1_PasswordRequired");
> ctl00_ContentPlaceHolder1_Login1_PasswordRequired. controltovalidate =
> "ctl00_ContentPlaceHolder1_Login1_Password";
> ctl00_ContentPlaceHolder1_Login1_PasswordRequired. errormessage =
> "Password is required.";
> ctl00_ContentPlaceHolder1_Login1_PasswordRequired. validationGroup =
> "ctl00$ContentPlaceHolder1$Login1";
> ctl00_ContentPlaceHolder1_Login1_PasswordRequired. evaluationfunction =
> "RequiredFieldValidatorEvaluateIsValid";
> ctl00_ContentPlaceHolder1_Login1_PasswordRequired. initialvalue = "";
> var ctl00_ContentPlaceHolder1_ValidationSummary1 = document.all ?
> document.all["ctl00_ContentPlaceHolder1_ValidationSummary1"] :
> document.getElementById("ctl00_ContentPlaceHolder1_ValidationSummary1");
> ctl00_ContentPlaceHolder1_ValidationSummary1.valid ationGroup =
> "ContentPlaceHolder1.Login1";
> // -->
> </script>
> It seems that the ValidationGroup for the internal controls of the
> Login control has been changed from "Login1" to
> "ctl00$ContentPlaceHolder1$Login1" causing a mis-match between the
> Login control and ValidationSummary.
> Is there a way of rectifying this?
> Many thanks in hope of a reply!!
> Ian
>
DWS
Thanks for taking the time to reply.
Whilst the Login control does have it's own validation - it only
displays the asterisk after the textbox and does not actually display a
message. This could be missed by some users.
I was hoping that the validation summary would show the error in a more
explicit way. I don't feel I am doing anything wrong - the
combination of Login and ValidationSummary works fine when not used
within a Content Placeholder.
I have so far worked around it by using the FindControl method:
Dim myLogin As Login
Dim mySummary As ValidationSummary
myLogin =
[LoginViewControlName].FindControl("[LoginControlName]")
mySummary =
[LoginViewControlName].FindControl("[ValidationSummaryControlName")
If myLogin IsNot Nothing Then
' Replace the returned underscores with dollar signs.
mySummary.ValidationGroup = Replace(myLogin.ClientID, "_",
"$")
End If
However, I'm really not happy in having to do it this way, and so any
other suggestions are more than welcome.
Many thanks
Ian
Ian,
I was having the same problem last night. It frustrated me for a good two
hours and I still have no fix. Glad to see that it's a problem with the
Master Pages, that was what I was going to try to test this time around... I
will probably end up using your workaround for now. If I come up with
something else I will let you know.
Dan
"ilockett" wrote:
> DWS
> Thanks for taking the time to reply.
> Whilst the Login control does have it's own validation - it only
> displays the asterisk after the textbox and does not actually display a
> message. This could be missed by some users.
> I was hoping that the validation summary would show the error in a more
> explicit way. I don't feel I am doing anything wrong - the
> combination of Login and ValidationSummary works fine when not used
> within a Content Placeholder.
> I have so far worked around it by using the FindControl method:
> Dim myLogin As Login
> Dim mySummary As ValidationSummary
> myLogin =
> [LoginViewControlName].FindControl("[LoginControlName]")
> mySummary =
> [LoginViewControlName].FindControl("[ValidationSummaryControlName")
> If myLogin IsNot Nothing Then
> ' Replace the returned underscores with dollar signs.
> mySummary.ValidationGroup = Replace(myLogin.ClientID, "_",
> "$")
> End If
> However, I'm really not happy in having to do it this way, and so any
> other suggestions are more than welcome.
> Many thanks
> Ian
>
Login control: remember me next time
between sessions? I aske because the duration a cookie is stored seems to be
set in web.config:
<authentication mode="Forms">
<forms timeout="10368000"/>
</authentication>
Does this value get used? Is the used value toggled between this and another
based on the value of the checkbox? If so, where is the other value set?
-Benthis value is if a use doesnt click on a web page in that amount of
time the session will end and they will need to login again.
another thing Ben, this is a session cookie and not stored on the
user's pc, unless told to when the cookie is created.
Hi Ben,
Thank you for posting!
Yes, the checkbox "remember me next time" on login control is to control
whether cookies are persisted.
In 2.0 the timeout for both persistent and session based cookies is
controlled by the timeout attribute on the <forms /> element.
Regards,
Walter Wang
Microsoft Online Community Support
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
I just noticed that there is a confirmed bug related to this issue:
http://lab.msdn.microsoft.com/produ...px?feedbackid=b
8145153-843b-42ff-8099-e3e8a8df5405
Sorry for the inconvenience.
Regards,
Walter Wang
Microsoft Online Community Support
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
login control: remember me next time
between sessions? I aske because the duration a cookie is stored seems to be
set in web.config:
<authentication mode="Forms">
<forms timeout="10368000"/>
</authentication
Does this value get used? Is the used value toggled between this and another
based on the value of the checkbox? If so, where is the other value set?
-Benaccidental duplicate post
"Ben R." wrote:
> what exactly does this do? does it control whether cookies are persisted
> between sessions? I aske because the duration a cookie is stored seems to be
> set in web.config:
> <authentication mode="Forms">
> <forms timeout="10368000"/>
> </authentication>
> Does this value get used? Is the used value toggled between this and another
> based on the value of the checkbox? If so, where is the other value set?
> -Ben
Login control: remember me next time
between sessions? I aske because the duration a cookie is stored seems to be
set in web.config:
<authentication mode="Forms">
<forms timeout="10368000"/>
</authentication
Does this value get used? Is the used value toggled between this and another
based on the value of the checkbox? If so, where is the other value set?
-Benthis value is if a use doesnt click on a web page in that amount of
time the session will end and they will need to login again.
another thing Ben, this is a session cookie and not stored on the
user's pc, unless told to when the cookie is created.
Hi Ben,
Thank you for posting!
Yes, the checkbox "remember me next time" on login control is to control
whether cookies are persisted.
In 2.0 the timeout for both persistent and session based cookies is
controlled by the timeout attribute on the <forms /> element.
Regards,
Walter Wang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
I just noticed that there is a confirmed bug related to this issue:
http://lab.msdn.microsoft.com/produ...px?feedbackid=b
8145153-843b-42ff-8099-e3e8a8df5405
Sorry for the inconvenience.
Regards,
Walter Wang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Login control?
database file with asp_regsql programme but I couldtn find where I ll add
the connection string of new database ? A sample page is here it also doesnt
work http://awayfromme.wonderfulreklam.com/
How can I deploy my local working page to host step by step.
Thanx for help in advance :)QUICKSTARTS, my friend:
http://quickstarts.asp.net/QuickSta...ty/default.aspx
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Yasin cepeci" wrote:
> My asp.net login controlled page doesnt work in web server. I ve created t
he
> database file with asp_regsql programme but I couldtn find where I ll add
> the connection string of new database ? A sample page is here it also does
nt
> work http://awayfromme.wonderfulreklam.com/
> How can I deploy my local working page to host step by step.
> Thanx for help in advance :)
>
>
Login control?
database file with asp_regsql programme but I couldtn find where I ll add
the connection string of new database ? A sample page is here it also doesnt
work http://awayfromme.wonderfulreklam.com/
How can I deploy my local working page to host step by step.
Thanx for help in advance :)QUICKSTARTS, my friend:
http://quickstarts.asp.net/QuickSta...ty/default.aspx
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Yasin cepeci" wrote:
Quote:
Originally Posted by
My asp.net login controlled page doesnt work in web server. I ve created the
database file with asp_regsql programme but I couldtn find where I ll add
the connection string of new database ? A sample page is here it also doesnt
work http://awayfromme.wonderfulreklam.com/
How can I deploy my local working page to host step by step.
Thanx for help in advance :)
>
>
>
login control: remember me next time
between sessions? I aske because the duration a cookie is stored seems to be
set in web.config:
<authentication mode="Forms">
<forms timeout="10368000"/>
</authentication>
Does this value get used? Is the used value toggled between this and another
based on the value of the checkbox? If so, where is the other value set?
-Benaccidental duplicate post
"Ben R." wrote:
> what exactly does this do? does it control whether cookies are persisted
> between sessions? I aske because the duration a cookie is stored seems to
be
> set in web.config:
> <authentication mode="Forms">
> <forms timeout="10368000"/>
> </authentication>
> Does this value get used? Is the used value toggled between this and anoth
er
> based on the value of the checkbox? If so, where is the other value set?
> -Ben
Login Controls
Hi
I'm using the login controls, and all is good except for the fact that i will be storing personal info on users in a diff table, so
i need to pass the UserID and be able to use the UserID of the logged in user to get the correct data on them.
so how do i get the userID, and where do i execute code to get the UserID and store it in a session var or something?
Thanks
Shem
You can do all this within the OnAuthenticate method:
publicvoid OnAuthenticate(object sender,AuthenticateEventArgs e)
{
bool Authenticated =false;
Authenticated = AuthenticateUser(lgLogin.UserName, lgLogin.Password);
if (Authenticated)
{
FormsAuthentication.RedirectFromLoginPage(lgLogin.UserName,false);
}
else
{
// do something else
}
}
Within this method pass the login details into another method. This second method can use the username to retrieve the userid and whatever other information, authenticate the user (checking it exists in database etc) and set some user information in session variables. After it does all this the second method returns a value of true, allowing the redirect from the login page.
Hope this helps.
Login Controls
An application that was built in ASP (not dot-net) uses an Access database to store usernames and passwords. A new user could create a new "account" and it would be entered into the database, and be ready for the user to log in, without requiring an Admin to manually add their account to the "Users/Groups/Roles/etc".
Now, I'm using VWD 2005 Express on Windows Server 2003 R2 ...
I start a new Website, and setup a Default.Master page.
I setup LoginView and have Login, CreateUserWizard, PasswordRecovery, etc.
Looks pretty good. CTRL-F5'd it, created an Admin account, and went through the motions with it. Everything looks good.
One question, instead of having to manually setup usernames and passwords, how can I use the old Access database, instead of having to use the .Net configuration utility?
Does this make sense? Any help would be greatly appreciated!! :)
Thanks
Iyt makes perfect sense. You need to write a custom membership provider. See thisdevx article for some code and samples.