.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
andyadmas
Post New Web Links

LoginView !

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net
 

Hello,

 

I have seen that it is very easy to make a login texbox by using loginview control and put the login control in AnonymouseTemplate and the welcome message in LoggedInTemplate. However, is this the professional and safe way to do it?

 

Cheers!

 

 




View Complete Post


More Related Resource Links

Create User Wizard and Loginview error

  

 When i place the create user wizard control inside the Loginview Anonymous Template, the Create User Wizard gives an error inside the C# file. Here is a snippet

Home.aspx Web Form

 <asp:LoginView ID="LoginView2" runat="server">
     <AnonymousTemplate>
        <asp:CreateUserWizard ID="CreateUserWizard1" CreateUserButtonType="Image" 
        CreateUserButtonImageUrl="~/images/signup.png" cssclass="createuser" 
        runat="server" OnCreatedUser="CreateUserWizard1_CreatedUser" 
        OnCreatingUser="CreateUserWizard1_CreatingUser">
           <TextBoxStyle CssClass="Ctextbox" />
            <LabelStyle cssclass="lbl" />
            <WizardSteps>
                <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server" />
                <asp:CompleteWizardStep   ID="CompleteWizardStep1" runat="server" />
            </WizardSteps>
        </asp:CreateUserWizard>
        </AnonymousTemplate>
        <LoggedInTemplate>
        
        news here
        
        </LoggedInTemplate>
        
        
        </asp:LoginView>


Here is the C# Code with the error 

<

loginview and Windows Authentication?

  
Can you use a loginview to hide a control (or set of controls) using WIndows Authentication?  All Ic an find are articles on Forms Authentication but I don't use that in my application.  Any other ideas on how to hide a control based on membership to an Active Directory group? 

Login contained within a LoginView Events firing?

  
Hi there,   I'm in the process of trying to figure out how to program in ASP.Net. My senario is this: (A) I've created a master Page (B) In The master page I have a Login Control that is contained in a LoginView control. I cannot figure out how to get the events to fire when it's in this sitution. Any help would be good. If the Login control is situated on it's own the events (LogginIn etc) will fire? 

LoginView.FindControl not finding control

  
I'm trying to bind data to a repeater. The repeater is inside a loginView control. Like so:            <asp:loginview id="loginView" runat="server">                <anonymoustemplate>                    <asp:repeater id="rpLessons" runat="server">                                            <itemtemplate>                            <div>                                <a  href="Default.aspx?lid=<%# Eval("PodID") %>"><%# Eval("Name") %></a><%#Eval("Duration")%>                            </div>                        </itemtemplate>    &n

How do i get the value of an embedded textbox in a loginview

  
hi guys,How do i get the value of an embedded textbox in a loginview ?I have a textbox, in a loginview1.How do i get the value of the textbox ?string user = Loginview1.Textbox1.Text ;thanksEhi

LoginView DropDownList

  
LoginView DropDownList4 = LoginView2.FindControl("DropDownList4") as LoginView;DropDownList4.SelectedValue = "abc";Why not find SelectedValue?What am I doing wrong?

LoginView Control Issue

  
I'm using VWD 2010 Express, and I'm working on a school lesson that I actually did approximately 2 years ago In VWD 2005 with no problems.  I am just learning to program, so my knowledge is very limited.The lesson walks me through creating a master page and then I created a page called "Login.aspx".  On the login page, I am dropping a LoginView control into the ContentPlaceHolder section, and then I'm supposed to type "Welcome !" into the LoginView box for the LoggedIn template, but the LoginView box is very small and when I start typing, the first couple of letters go into the LoginView box, and then they start showing up on the far left outside of the LoginView control.  When I try to click back in the LoginView window, it will only select the entire control, and I can no longer modify what's in the box (unless I go to Source view).  I can't even begin to explain how frustrating this is!!!  It's tough enough trying to learn this stuff and now my development tool is giving me grief!  I don't understand why it worked fine in VWD 2005, but not now (and I'm using the same exact lesson material).

LoginView, DropDownList, Cookie, AutoPostBack Conundrum

  
OK, I am at a complete loss. Users for my site can have many stores to configure under their one user account. When they login I have the app generate a cookie for each store and hold all the stores basic information. For each cookie I then generate a list item in a drop down list. I can get the list to generate just fine and all of the pages that reference the list get the information fine. When I change the list to a different item however, and the page posts back my first LoginView is set to LoggedInTemplate while my navigation loginview (in site.maser like the first one) and my content loginview (in the actual page) come back in AnonymousTemplate, even though the user is authenticated. I can either do a response.redirect or physically refresh the page and all loginviews are in LoggedInTemplate again. The problem is though that I lost all of the postback data so I can essentially only view information on the first item in the dropdownlist. Now, I am new to asp.net authentication, and while I feel that I am starting to get the hang of it, there is a very good chance that I am doing something wrong. I have all the authentication working correctly and except for this postback issue. I can login, navigate through pages that aren't accessible without being authenticated and I can logout without issue. If anyone has any suggestions it would be gr

DataList Within LoginView

  
I've a datalist within the logged in template. On the page_load first I'm ensuring the visitor is logged inIf User.Identity.IsAuthenticated Then Following that I'm just trying to populate the datalist... Dim myDataAdapter As SqlDataAdapter Dim strToday As String = DateTime.Today.ToString("dd MMM yyyy") conConnect = New SqlConnection(connstring) myDataAdapter= New SqlDataAdapter("SELECT command goes here FROM my table", conConnect) Dim ds As Data.DataSet = New Data.DataSet myDataAdapter.Fill(ds) Dim DataList1 As DataList = LoginView1.FindControl("DataList1") DataList1.DataSource = ds DataList1.DataBind() conConnect.Close()   However this doesn't work, I get the following error: Object reference not set to an instance of an object.... Highlighting: DataList1.DataSource = ds If I take the loginview away then it works, but I thought the loginview1.findcontrol part would solve any problems. I would appreciate any help.

Div in LoginView findcontrol

  
Hi,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: Line 785: Line 786: Line 787: Div.Visible = false; Thanks for your help!

LoginView and Windows authentication

  

Hello *,

i have a problem with the users authentication on my site. I made <authentication mode="Windows"

Windows Authentication with Loginview

  

I am developing an application for my companys intranet and I have opted to use Windows Authentication for the sake of Active Directory. I have now come into a situation where Id like to use a Loginview to control the elements that each user can see on specific web forms but I would like to know how this can be achieved seeing as you cannot set roles and such like with Windows Authentication.

 


link to profile inside Loginview

  

I've searched for a while but I can't find anything helpful.

I need to have a link inside my asp:Loginview that says "My profile" and links to the users profile. Am I ignorant :S ?



Thnx in advance!


Displaying Role-Specific Markup With the LoginView Control

  

Hi,

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 Mode

Help with LoginView control

  

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 cant see the pages and data.

 

Can anyone offer some assistance or links to good tutorials?

 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.

 

    <asp:LoginView ID="LoginView1" runat="server">
        <RoleGroups>
            <asp:RoleGroup Roles="Admin">
                <ContentTemplate>
                You are an Admin!
                </ContentTemplate>
            </asp:RoleGroup>
            <asp:RoleGroup Roles="User">
                <ContentTemplate>
                You are a user!
                </ContentTemplate>
            </asp:RoleGroup>
        </RoleGroups>
        <LoggedInTemplate>
        <asp:GridView ID="GridView1" runa

Login Control , LoginView, Page Redirection

  

Hi and thanx for giving your time.

I have Default.aspx page with Login control.

code:

protected void Login2_Authenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e)
        {
            //verify that the username/password is valid
            if (Membership.ValidateUser(Login2.UserName, Login2.Password))
            {
                

                if (Roles.IsUserInRole(Login2.UserName, "Administrator"))
  &

Removed text boxes from within loginview control and now nothing is returned via ValidateUser.

  

I removed two textboxes (textbox_LoginName and textbox_Password) and a button (button_Login) from a LoginView control by cutting and pasting. I placed them within a panel. In the code behind for the login file I removed the FindResource method that I had to use while the controls were buried within the LoginView control. This allowed my to simply use the Text properties of the textboxes as the parameters for the ValidateUser method.

The ValidateUser method was working prior to making the changes. Now, however, when called if the user is a legitimate username and password it returns no user at all - just empty strings/nulls. If the login credentials are incorrect it behaves as normal.

Here is my code:

 protected void button_Login_Click(object sender, EventArgs e)
    {
        // Validate user against the Membership framework user store.
        if (Membership.ValidateUser(textbox_LoginName.Text, textbox_Password.Text))
        {
            string myUser = User.Identity.Name;


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend