First, I have to admit I only know about the global.asax file from
(basically) here: http://en.wikipedia.org/wiki/Global.asax

In web2py, wne a sequest comes in with no direction (just top URI), web2py
will look for an applicaiton  "init", or if not found then an application
"welcome".   Once the default app is found, the models are read in to setup
context, and the default controller is searched for an index function.

Those are the default basics.  You can modify this with the routes.py file,
but for now just be aware there is a way to map requests.

Now, when a session starts, and you go to the selected controller-function,
it is executed.   The way to enforce that a user is to ensure they are
logged in.  In python you do this with so-called decorators, which are
basically functions that wrap the functions they precede (that's a bit of an
oversimplification, but a useful concept).

To accomplish what you want in web2py, you would use the authentication
system, and precede each of your functions ("pages") that require login
such:

@auth.requires_login()
def index():
   # your code

See http://www.web2py.com/examples/default/tools for a bit more.

On Thu, Jul 23, 2009 at 2:17 PM, Delaney <delaney.bu...@gmail.com> wrote:

>
> Hi guys! i am new to web2py but so far very very impressed! I have
> come form asp.net background and I am trying to find a similar concept
> to the global.asax file in web2py. effectively i want the user to be
> automatically redirected to the logon screen on session start , is
> that possible or have i missed something! Any help would be mch
> appreciated.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to