Bit lost (inherits/imports) for secure login...

Discussion in 'ASP .Net' started by Rob Meade, Jan 28, 2004.

  1. Rob Meade

    Rob Meade Guest

    Hi all,

    ok - the scenario...

    We have a secure login page known as the Clinical Portal (single login
    etc) - we have a web user control for this which checks if a session is
    available or not and redirects the user to the Clinical Portal to login if
    not etc.

    I have dragged the .ascx (SessionCheck.ascx) across and thought all was well
    until I tried to pick up one of the created sessions within the page_load
    for my page - it seems that the order of events happening is that the
    page_load for my main page is firing before the page_load on the .ascx etc
    therefore the session has not yet been created - result - I get bounced back
    to the login page.

    I checked to see what a colleague has done (he's away at the moment and cant
    ask etc) - it seems that he took the code for the session checking out of
    the page_load within the .ascx and put it in a Sub

    Sub CPUser()

    firstly - is this ok? Should it be private sub, public sub or any other
    kind (we're all quite new to .net)...

    ok - assuming that that is indeed ok - I assume that to then use that on a
    page I would need something like

    Call CPUser()

    however when I've tried this I got the following error :

    Name CPUser is not declared

    I took another look at his code and at the top of the .vb file for his page
    he has

    Imports application_name.SessionCheck

    so I added the same - now I get this error :

    Reference to a non-shared member requires an object reference.

    I have no idea what this means - so I looked at his code again - this time I
    also spotted the following inherits line :

    Inherits application_name.SessionCheck

    When I added this I was given another error telling me I could only have ONE
    inherits statement, I currently have :

    Inherits System.Web.UI.Page

    So - now I'm completely lost - if I remove the lines above (imports,
    inherits and call etc) then my page still works, but theres obviously not
    session checking going on.

    Can anyone give me any pointers as to how I should be using the .ascx file -
    ie, how I include the code in my page - I must preferred the initial way of
    just dragging and dropping the .ascx file because I was hoping that this
    could be easily built into our template, rather than having to add some code
    to each and every page..

    If anyone can help I'd be grateful - I've not posted any code as there's a
    fair bit of it, but if its needed I can happily post it up..

    Regards

    Rob
     
    Rob Meade, Jan 28, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Nitulescu
    Replies:
    0
    Views:
    376
    Alex Nitulescu
    Feb 22, 2005
  2. Bart_D
    Replies:
    7
    Views:
    2,240
  3. Arpan

    Diff. B/w Imports & Inherits?

    Arpan, Sep 20, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    451
    Sean Chambers
    Sep 20, 2006
  4. Albert
    Replies:
    4
    Views:
    11,028
    Albert
    Jul 10, 2008
  5. ton
    Replies:
    1
    Views:
    1,070
    Teemu Keiski
    Jun 24, 2007
Loading...

Share This Page