Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

is the best way - postback login change

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kal - 16 Jun 2007 10:45 GMT
Hi,

I have a login control in a master frame.
In the page_load event handler i check
to see if a user is logged in or not and then
display their name or the login control.

This runs every time a new page is loaded.
Is this an efficient way to do this?

even if i use !ispostback it runs because
navigation isnt posting back.

Thanks for advice

Kal
ThatsIT.net.au - 16 Jun 2007 16:32 GMT
> Hi,
>
[quoted text clipped - 12 lines]
>
> Kal

try putting your code in the global.asax file use the session onstart sub

   if loggedIn <> true then
        response.redirect("login.aspx")
   end if

now in your login page include

    Session.Abandon()

Now if any one tries to navigate to one of your pages without being logged
in they will be directed to the login page, if they are logged in  they will
not be tested again
Mital  Kakaiya - 17 Jun 2007 00:37 GMT
Hi,

If you are using .NET 2.0 framework, have a look at LoginView Control:

<asp:LoginView ID="LoginView1" Runat="server">
           <AnonymousTemplate>
               User is not logged in.<br />
               Add <asp:Login /> control here.
           </AnonymousTemplate>
           <LoggedInTemplate>
               User is logged in.<br />
           </LoggedInTemplate>
</asp:LoginView>

For more info:
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.loginview.aspx

Regards,
Mital
http://mital.kakaiya.com

> Hi,
>
[quoted text clipped - 12 lines]
>
> Kal

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.