Sunday, December 27, 2009

Login Controls in ASP.NET using Oracle

In asp.net The Login controls does automatic using MSSql. Now we want to use Oracle.

1. Create a new project.

2. Connect it to oracle. If you don't know how to connect oracle in asp.net please see this link

3. In web.config file change the following line From

   <authentication mode="Windows"/>     To   
   <authentication mode="Forms"/>

4. Now you want to view some content who are logged in. But those are not logged in they do not see that content. So, add a LoginView control. Go to Source view.

 <asp:LoginView ID="LoginView1" runat="server">
                        <AnonymousTemplate>
                            Welcome guest.You are not logged in. To view the page please loggin.
                        </AnonymousTemplate>
                       
                        <LoggedInTemplate>
                            Welcome :
                            <asp:LoginName ID="LoginName2" runat="server" />
                        </LoggedInTemplate>                      
                    </asp:LoginView>



5. I have created a Private_Page.aspx that will only show the people who have logged in. If you are not logged in but u want to access the page using URL like "http://localhost/Private_Page.aspx" then u r redirect to login page. But if u are logged in and access the private page using URL then u will be able to view the page.


6. If u have many pages and u want to show that the people whether logged in or not , just put on the page a LoginStatus control. 


7. If you show the user name just put on a LoginName control.


8. You should not do anything for loginstatus or loginname, just put this two control.


9. I have uploaded a sample project. If any query mail me or comment here.

Here Is the sample project



Regards
Md. Humayun Kabir

No comments:

Post a Comment