Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > is the best way - postback login change

Reply
Thread Tools

is the best way - postback login change

 
 
kal
Guest
Posts: n/a
 
      06-16-2007
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


 
Reply With Quote
 
 
 
 
ThatsIT.net.au
Guest
Posts: n/a
 
      06-16-2007

"kal" <(E-Mail Removed)> wrote in message
news:6jOci.278$(E-Mail Removed)...
> 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
>



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

 
Reply With Quote
 
 
 
 
Mital Kakaiya
Guest
Posts: n/a
 
      06-16-2007
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/lib...loginview.aspx

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


On Jun 16, 7:45 pm, "kal" <(E-Mail Removed)> wrote:
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any way to convert an async postback to a full postback incode-behind? Ed Cayce ASP .Net 0 08-07-2009 11:23 PM
Proper way to reload CompositeControl when its state must change after Postback jeljeljel ASP .Net Building Controls 1 09-20-2007 07:36 PM
Proper way to reload CompositeControl when its state must change after Postback jeljeljel ASP .Net Web Controls 0 09-20-2007 01:18 PM
Login Controls - Force user to change password at next login pj ASP .Net 2 10-31-2006 12:16 AM
Re: PLEASE? Any way to get the user's nt login from the pc -- not the server login? William F. Robertson, Jr. ASP .Net 0 07-02-2003 03:57 PM



Advertisments