Security :: Get Username Based On Loginview Control?

Jan 6, 2011

This may be very simple but I can not figure it out. I am using ASP.Net 3.5/Visual Studio 2010. I have placed a LoginName Control on the page and the login name is properly displaying. I am using forms Authentication and it is set up properly in the web config file. I simply want to insert the logged in username value into the database table so I can track who created the records. I am happy to be able to insert the UserID value. I assume the values are derived out of the aspnet_Users table. Hopefully someone can provide a way to do either. I am not a coder so giving me a quick try this answer won't help me much. I would need to really see the entire solution and code.

View 4 Replies


Similar Messages:

Security :: Equivalent For LoginView Based On Roles?

Apr 21, 2010

I have a website where users can login and they have different roles/privileges. I want to have it where the user's view of the webpage is determined by their role. Right now I am storing the role in the UserData property of the FormsAuthenticationTicket class (which is retrieved from a database during login). When the main page is loading, I want it to check the user's role and then only show the controls/portions of the page that are for that role. For example, if the user is not an administrator, they shouldn't be able to click on a button to delete a record. At the moment I am using labels to hide or show areas depending on the user's role. Something like this:

[Code]....

[Code]....

And here is a portion of the markup code with the Labels:

[Code]....

This works, but doesn't seem to be a very good way to handle this type of thing. Is there a cleaner, more elegant way of doing this? Something similar to the LoginView control, but which I can use for roles?

View 4 Replies

Security :: LoginView.FindControl (PasswordRecovery Nested Inside LoginView / AnonymousTemplate)

Apr 30, 2010

I use master/content page and use this code (below) for validation, if I place the PasswordRecovery outside LoginView the validation is marked up correctly, but placed back inside the LoginView the PasswordRecovery compilation error is CS0103: The name 'PasswordRecovery1' does not exist in the current context.

[code]....

View 1 Replies

Security :: Login Control Inside A LoginView Control?

May 17, 2010

I have a image CAPTCHA script (downloaded from the web) that I am placing inside a Login control. I have also place that Login control inside the annonymous template of a LoginView control.

When I try to do the image verification the text box to verify keeps coming up Null and gives me an " NullReferenceException: Object reference not set to an instance of an object" error.

I have the same control working inside the CreateUserWizard control so I am not sure what's wrong.

[code]....

I have tried variations for the LoginView1.FindControl("txtVerify"); but this is the only one I have been able to use with Intellisense that does not cause a build error.

View 4 Replies

Security :: LoginView Is Suddenly Disappear When Use The Control?

Jan 13, 2011

I have a loginview control placed in my page:

[Code]....

When user login into my application,the note saying that Welcome,Joe is show.But,when user try to input something into web page (such as fill in the text box),the LoginName1 that refer to "Joe" is suddenly disappear.Why this happen?

View 1 Replies

Security :: LoginView Control / Can't See The Pages And Data?

Oct 14, 2010

Now that some of the Security matrix has been approved and site is somewhat more functional. We are going back thru adding the loginview to the pages that need it so we can control who can adn can't see the pages and data.

To keep it simple, here is what i have setup.. Because if this setup, i cant access my controls and the page wont display either template. Now even though the aspx code below is a very stripped down version of what i have, the code behind has references to controls that dont show in my example, but they are there in my actual page. I Just removed alot of information to make the post more clear.

[Code]....

[Code]....

View 7 Replies

Security :: C# - Assign Value To Control Which Is In LoginView's RoleGroup?

Jun 25, 2010

I have to assign default value to my asp.net controls which are residing inside the RoleGroup of Asp.net's LoginView control.

Here is a piece of my code-

[Code]....

[Code]....

But I'm getting this error:

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Can anyone tell me why I'm getting this error? And what is the right way of accessing those controls from code behind which are placed inside a loginView's RoleGroup?

View 1 Replies

Security :: Loginview Control To Manage Membership?

Jun 12, 2010

I am using loginview control to manage membership loggled in data and anonymous data. But since I have to copy entire data to login view template. I think it is not perfect solution in case i just have few differences in all type of templates. I tried to use loginview whenever I actually need it. But it supports just after form declaration.

Also what if I need to have multiple loginviews. Is there any way to do this manually. I just dont like to copy entire design for each template and just like to manage identical changes.

View 1 Replies

Security :: Adding A Loginview Control To A Page?

Jul 18, 2010

I have a page that originally didn't contain a login view. I have now added one of those so that I can vary the display according to role membership.

However I have some VB code that references ojects that were originally on the main page but now sit within the Loginview. These code segments were triggered on a Page_Load event. Since moving the objects on the page all of the references to objects there now fail as if they didn't exist. (Presumably because they are now within a LoginView)

I assume I need to change the location of my code but am stuck to find out where it should now go.

I assuem now I need two versions of my code too - one to match each of the two role possibilities for the LoginView?

View 4 Replies

Security :: Displaying Role-Specific Markup With The LoginView Control?

Oct 14, 2010

I want to know how can I display role-specific markup using loginview?

I have these three roles, Admin, Editor, Moderator

Each and every user will belog to only one of the following role groups

1. Admin, Editor, Moderator (Some user/s will have all these three roles)
2. Admin, Editor (Some user/s will have all these two roles)
3. Admin, Moderator (Some user/s will have all these two roles)
4. Editor, Moderator (Some user/s will have all these two roles)
5. Admin (Some user/s will have all only this role)
6. Editor (Some user/s will have all only this role)
7. Moderator (Some user/s will have all only this role)

Now I want to display some links that will be specific for each role group to which one or more users will belong. So the links I want to display for these role groups are following

1. Admin, Editor, Moderator => Only Links of all the pages of Admin, Editor and Moderator
2. Admin, Editor => Only Links of all the pages of Admin and Editor
3. Admin, Moderator => Only Links of all the pages of Admin and Moderator
4. Editor, Moderator => Only Links of all the pages of Editor and Moderator
5. Admin => Only Links of all the pages of Admin
6. Editor => Only Links of all the pages of Editor
7. Moderator => Only Links of all the pages of Moderator

I have tried doing this using RoleGroups in Loginview but couldn't succed.

Can anybody let me know the correct way of going this?

View 13 Replies

Security :: Why The Message Typed Into LoggedInTemplate Of The LoginView Control Was Repeated Several Times

Apr 27, 2010

In my Membership.aspx, I added a LoginView control. Then on the LoggedInTemplate, I typed "You are Logged in. Welcome," and a LoginName control. After testing from ASP.NET Development server and IIS server, now my LoggedInTemplate showed "You are Logged in. Welcome," several times before displayed only one LoginName/UserName. Why? Something wrong when testing in the ASP.NET Development environment or IIS server configuration?

View 3 Replies

Security :: LoginView Control: Programmatically Created, Doesn't Switch From Anonymoustemplate To Loggedintem?

Mar 30, 2010

I'm creating a LoginView in a class file rather than at design time.

The equivalent LoginView created in a .aspx page and used the same way works fine, and User.Identity.IsAuthenticated is switching from false to true once I log in as a user so the problem must not be there.

But even once logged in, the programmatic version of this LoginView is not switching from the Anonymous template to the LoggedIn and the output is always "You are not logged in".

Anyone have ideas? thanks.


here is my code to create the loginview

private void BuildAddCommentView(HtmlTextWriter htmlTextWriter)
{
LoginView commentsLoginView = new LoginView();


commentsLoginView.AnonymousTemplate = new LoginViewTemplate("AnonymousTemplate");
commentsLoginView.LoggedInTemplate = new LoginViewTemplate("LoggedInTemplate");

commentsLoginView.DataBind();

commentsLoginView.RenderControl(htmlTextWriter);
}


here's the LoginViewTemplate class

class LoginViewTemplate:ITemplate
{
string _templateType;

public LoginViewTemplate(String templateType)
{
_templateType = templateType;
}

public void InstantiateIn(Control container)
{

Label label = new Label();

switch (_templateType)
{
case "AnonymousTemplate":
label.Text = "You are not logged in.";
container.Controls.Add(label);
break;
case "LoggedInTemplate":
label.Text = "YOU ARE LOGGED IN.";
container.Controls.Add(label);
break;
}

}

}

View 4 Replies

Security :: Get The Username From A LoginvView Control?

Nov 23, 2010

I'm trying to limit what a user can see based on the roles that the user is in. I need the username to figure out what role they are in. I cannot, for the life of me, figure out how to get the username out of this loginView control. I have tried drilling down into the controls of the loginView but can only ever get this:

[Code]....

View 12 Replies

Security :: UserName (LoginName) Control Gets Changed?

Dec 22, 2010

What will happen if we follow below steps?

1) Open Login.aspx from our web site

2) Copy the address bar

3) Login it with User and Password

4) Open another Tab or another IE window paste the copied address and hit 'enter'

5) Login with another User Name

Now login with atleast 3 to 4 Users.

All Users should see same form but different contents.

Now, if we press refresh button then contents will get change but check wheather the Logged In User name is chaning or not.

I worked on VS 2010 default site.master.

Here, I already applied above process and when I do this my UserName (LoginName) control gets changed.

I ask the question here : http://forums.asp.net/t/1625117.aspx. And still I am doing R & D on it.

View 3 Replies

Security :: How To Focus On ChangePassword UserName Control

Jan 6, 2010

I have been able to set focus on the UserName TextBox of my Login control in the OnLoad event by performing the following.

[Code]....

I have tried replicating the above for my ChangePassword control however I get an exception stating that the object is null.

I have the DisplayUserName property set to true.

View 5 Replies

Security :: Disabling Username In ChangePassword Control?

Feb 14, 2010

I'm using the asp:ChangePassword control. I would like to disable the ability for the user to enter a new username but the default shows the current user's UserName and allows editing. Ideally, I would be able to find the child control in the ChangePassword control that is the UserName textbox and set Enable=false.

View 2 Replies

Security :: Getting More Data For A Username From The Login Control?

Sep 17, 2010

i have went with the standard membership method for validating and logging users into the application. i have added a column to the adpnet_Users table called customer_number.

once the user is logged in, i want to get the customer number for that user. what is the best / easiest / industry standard method of accomplishing this?

View 3 Replies

Security :: Modifying The CreateUser Control To Add Username To A Second Table?

Aug 11, 2010

I have a CreateUserWizard control to be able to allow an anonymous user to create an account. Provided that all entered information is correct that the user enters, a new account is created for him/her. But also, when this user is created, I want to [b]also[/b] add the username to another table in my ASPNETDB database. How exactly can I "tap" into the event that creates a user and adds it to the appropriate tables (aspnet_Users, Members, etc.) and make it add the username to yet another table?

View 1 Replies

Security :: Create Login Control With DropDown List For Username?

Feb 18, 2011

I have an ASP.Net application that uses the Membership Login Control. The thing is, we wanted to avoid giving our members more than they need to worry about, so we didn't want to have to make each a custom username. So the thing is, I want to make the Login Control display a DropDown List populated with a list of usernames as opposed to a text box.

View 7 Replies

Security :: Update Username Of Current Logged Username?

Mar 12, 2010

How to update username of current logged username?

View 10 Replies

Security :: How To Redirect User To An Error Page From Login Control Upon Entering Wrong Username

Mar 1, 2011

I wanted to know how to add the feature- that user should be redirected to an error page where the error will be display, upon entery wrong username/password when trying to login through an asp.net login control?

1. how to redirect the user to an error page upon entering wrong username/password (from a login control which is placed on master page)?

2. how to pass the error to the error page so it can be displayed there?

View 28 Replies

Security :: Div In LoginView Findcontrol?

Sep 11, 2010

This code works:

<div id="GridDiv" runat="server">
gridview would go in here....
</div>
GridDiv.Visible=false;

However, because I have a Div in LoginView2 I have to find with findcontrol.

This is not work:

LoginView Div = LoginView2.FindControl("GridDiv") as LoginView;
Div.Visible = false;

Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

[Code]....

Line 785:
Line 786:
Line 787: Div.Visible = false;

View 4 Replies

Security :: LoginView, Sign Up, Customization?

Apr 18, 2010

What is the easiest way to manipulate the built in LoginView and membership handlers so that users of a website can sign up with just their email (entered twice) and a password (entered twice)? The default is asking the user for a username, the email (just once) and the password (twice). How can this be tweaked, including adjusting the in-built aspnetUser table in the database?

View 4 Replies

Security :: Getting An Error When Populate A Literal In LoginView?

May 20, 2010

In my MasterPage, I'm using LoginView control that looks like this:

[Code]....

In the code behind, here's what I do:

[Code]....

When I try to pull up the home page -- as an unauthenticated user -- I get "Object reference not set to an instance" error pointing to where I start building the user menu i.e. litUserMenu.Text = "<li>...

View 1 Replies

Security :: Access Controls Inside LoginView?

Jul 20, 2010

I'm using roles based authenication and am trying to populate a dropdown list from Page_Load that resides inside a LoginView control. My problem is my code behind file doesnt recognize controls inside the LoginView templates.

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved