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

R

Rob Meade

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top