I hate to ask, but...

  • Thread starter Thread starter james
  • Start date Start date
J

james

I'm used to windows forms programming. Just tackling something in asp.net as
a web app - I have got to the point where I have a login form that works,
and on the resulting page I have a loginview. That page has a design layout
and a source layout, then I also have a code layout. In the code layout I
have written a function that only should be called if the user is logged in,
so, in the source for the page, how do I call my function in the "loggedin"
template of my LoginView?
I tried wrapping it in <code> tags but it just displays the name of the
function...

James.
 
James,

How are you doing the login? Are you providing a custom membership
provider? ASP.NET 2.0 has a rich provider interface that will let you
create your principal (implementation of the IPrincipal interface) and
expose it to your pages.

Then, you would just check the User property on your page and if it is
null, you know the person is not logged in.

Check out the following article on forms authentication, it should help:

http://aspnet.4guysfromrolla.com/articles/120705-1.aspx

You can also check out the documentation in MSDN on implementing a
membership provider:

http://msdn2.microsoft.com/en-us/library/f1kyba5e.aspx

Hope this helps.
 
Nicholas Paldino said:
James,

How are you doing the login? Are you providing a custom membership
provider? ASP.NET 2.0 has a rich provider interface that will let you
create your principal (implementation of the IPrincipal interface) and
expose it to your pages.

Then, you would just check the User property on your page and if it is
null, you know the person is not logged in.

Thanks - page.user.identity was exactly the area I was looking for. All
seems working now, thanks for the help!
James.
 
Back
Top