Base pages and abstract functions

  • Thread starter Thread starter Steve H.
  • Start date Start date
S

Steve H.

I use a base page, and decided that an abstract function is best for
guaranteing that the page has been checked for permissions.

basepage (inherits from Page)
-------------------
protected override void oninit(eventargs e)
{
if(!haspermissions())
response.redirect ("/notallowed.aspx")
}

child pages (inherits from basepage)
-------------------
protected override bool haspermissions()
{
return(true)
}

this breaks design mode, are there other ways of doing the same that would
also allow developers to use design mode?

We cant use the builtin formsbased authentication because 3/4 of our current
code is written in asp3.0.
 
The designer creates an instance of all classes, including the base class.
However, since it's abstract it can't. It's just how VS.Net 2003 is,
personally, I'd call it a very buggy behaviour :)
 
basepage was abstract also. Was a dumb error.

Now I'm using a virtual function and it works fine. Will probably
response.write a message to the developers that says "you need tro override
has permissions" if it's not already overridden.

Idealy I wanted to make it required to override the function in order to
compile the code.
 

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

Back
Top