Connecting Tech Pros Worldwide Forums | Help | Site Map

Base pages and abstract functions

Steve H.
Guest
 
Posts: n/a
#1: Nov 19 '05
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.



KMA
Guest
 
Posts: n/a
#2: Nov 19 '05

re: Base pages and abstract functions


Out of interest, why does it break?


"Steve H." <hangarhaun@hotmail.com> wrote in message
news:Or0fAlayFHA.2212@TK2MSFTNGP15.phx.gbl...[color=blue]
> 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[/color]
current[color=blue]
> code is written in asp3.0.
>
>[/color]


Karl Seguin
Guest
 
Posts: n/a
#3: Nov 19 '05

re: Base pages and abstract functions


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 :)



--
MY ASP.Net tutorials
http://www.openmymind.net/
"KMA" <kma@chum.com> wrote in message news:di0inj$moi$1@atlas.ip-plus.net...[color=blue]
> Out of interest, why does it break?
>
>
> "Steve H." <hangarhaun@hotmail.com> wrote in message
> news:Or0fAlayFHA.2212@TK2MSFTNGP15.phx.gbl...[color=green]
>> 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[/color]
> current[color=green]
>> code is written in asp3.0.
>>
>>[/color]
>
>[/color]


Karl Seguin
Guest
 
Posts: n/a
#4: Nov 19 '05

re: Base pages and abstract functions


Don't make the base class abstract...

or

a master page might be able to help
(http://www.metabuilders.com/Tools/MasterPages.aspx free)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Steve H." <hangarhaun@hotmail.com> wrote in message
news:Or0fAlayFHA.2212@TK2MSFTNGP15.phx.gbl...[color=blue]
>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.
>[/color]


Steve H.
Guest
 
Posts: n/a
#5: Nov 19 '05

re: Base pages and abstract functions


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.

"KMA" <kma@chum.com> wrote in message news:di0inj$moi$1@atlas.ip-plus.net...[color=blue]
> Out of interest, why does it break?
>
>
> "Steve H." <hangarhaun@hotmail.com> wrote in message
> news:Or0fAlayFHA.2212@TK2MSFTNGP15.phx.gbl...[color=green]
>> 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[/color]
> current[color=green]
>> code is written in asp3.0.
>>
>>[/color]
>
>[/color]


Closed Thread