473,382 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

how to change this code to ASP.NET 2 ?

Tee
in ASP.NET 1.1,

I created a Class, and the class Inherits System.Web.UI.Page ...

I write my common error handling code there, under Protected Overrides Sub
OnError(ByVal e As System.EventArgs)

and all my ASPX inherits the class with no problem.
But in ASP.NET 2, how can I do the same ?

I can't get my ASPX file to inherits any other thing beside
System.Web.UI.Page ...

anyone know how ?
Thanks,
Tee
Nov 18 '05 #1
6 1206
Hi,

in ASP.NET 2 the code-behind(beside) class is one and the same class with
the dynamically created page class as they use the new partial class feature
of the Framework 2. It also means that the Page inherits implicitly from
System.Web.UI.Page.

This is error what I get when trying to have another base class:

Base class 'MyDemoClass' specified for class 'Default_aspx' cannot be
different from the base class 'System.Web.UI.Page' of one of its other
partial types.

You can do it by handling the error in global.asax.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke


"Tee" <th*@streamyx.com> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
in ASP.NET 1.1,

I created a Class, and the class Inherits System.Web.UI.Page ...

I write my common error handling code there, under Protected Overrides Sub
OnError(ByVal e As System.EventArgs)

and all my ASPX inherits the class with no problem.
But in ASP.NET 2, how can I do the same ?

I can't get my ASPX file to inherits any other thing beside
System.Web.UI.Page ...

anyone know how ?
Thanks,
Tee

Nov 18 '05 #2
Tee
Hi,

So do you meant I have to re-structure my code in order for it to work in
ASP.NET 2 caused of there is no other way can replace it ?

Then why is .Net Framework saying Backward Compatibility ?
Thanks,
Tee

"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:eA**************@TK2MSFTNGP09.phx.gbl...
Hi,

in ASP.NET 2 the code-behind(beside) class is one and the same class with
the dynamically created page class as they use the new partial class feature of the Framework 2. It also means that the Page inherits implicitly from
System.Web.UI.Page.

This is error what I get when trying to have another base class:

Base class 'MyDemoClass' specified for class 'Default_aspx' cannot be
different from the base class 'System.Web.UI.Page' of one of its other
partial types.

You can do it by handling the error in global.asax.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke


"Tee" <th*@streamyx.com> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
in ASP.NET 1.1,

I created a Class, and the class Inherits System.Web.UI.Page ...

I write my common error handling code there, under Protected Overrides Sub OnError(ByVal e As System.EventArgs)

and all my ASPX inherits the class with no problem.
But in ASP.NET 2, how can I do the same ?

I can't get my ASPX file to inherits any other thing beside
System.Web.UI.Page ...

anyone know how ?
Thanks,
Tee


Nov 18 '05 #3
Well,

remember that this is only the first beta so its not final (neither is the
compatibility). In practise there will probably be tradeoffs and the
backwards compatibility won't be perfect even though MS tries their best
with it. It is just the goal.

You might also have a look at ASp.NET 2.0 forums at ASp.NET Forums
(www.asp.net/forums)

See also these interesting threads:
http://www.asp.net/Forums/ShowPost.a...&PostID=612882
http://www.asp.net/Forums/ShowPost.a...&PostID=622319
http://www.asp.net/Forums/ShowPost.a...&PostID=627529

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"Tee" <th*@streamyx.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hi,

So do you meant I have to re-structure my code in order for it to work in
ASP.NET 2 caused of there is no other way can replace it ?

Then why is .Net Framework saying Backward Compatibility ?
Thanks,
Tee

"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:eA**************@TK2MSFTNGP09.phx.gbl...
Hi,

in ASP.NET 2 the code-behind(beside) class is one and the same class with
the dynamically created page class as they use the new partial class

feature
of the Framework 2. It also means that the Page inherits implicitly from
System.Web.UI.Page.

This is error what I get when trying to have another base class:

Base class 'MyDemoClass' specified for class 'Default_aspx' cannot be
different from the base class 'System.Web.UI.Page' of one of its other
partial types.

You can do it by handling the error in global.asax.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke


"Tee" <th*@streamyx.com> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
in ASP.NET 1.1,

I created a Class, and the class Inherits System.Web.UI.Page ...

I write my common error handling code there, under Protected Overrides

Sub OnError(ByVal e As System.EventArgs)

and all my ASPX inherits the class with no problem.
But in ASP.NET 2, how can I do the same ?

I can't get my ASPX file to inherits any other thing beside
System.Web.UI.Page ...

anyone know how ?
Thanks,
Tee



Nov 18 '05 #4
Tee
Hi Teemu,

Thanks for your reply to few of my post here.

After spending sometimes in ASP.NET 2, I found that we still can inherits
another class. But we need to do this in the html source <%@ Page .....%>.

eg:
<%@ Page Inherits="Class1" Language="C#" CompileWith="Default2.aspx.cs"
ClassName="Default2_aspx" MasterPageFile="~/MasterPage.master" %>
the class to inherits must have inherited to System.Web.UI.Page or else it
will give error.
Thanks,
Tee

"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:Oa**************@TK2MSFTNGP12.phx.gbl...
Well,

remember that this is only the first beta so its not final (neither is the
compatibility). In practise there will probably be tradeoffs and the
backwards compatibility won't be perfect even though MS tries their best
with it. It is just the goal.

You might also have a look at ASp.NET 2.0 forums at ASp.NET Forums
(www.asp.net/forums)

See also these interesting threads:
http://www.asp.net/Forums/ShowPost.a...&PostID=612882
http://www.asp.net/Forums/ShowPost.a...&PostID=622319
http://www.asp.net/Forums/ShowPost.a...&PostID=627529

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"Tee" <th*@streamyx.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hi,

So do you meant I have to re-structure my code in order for it to work in
ASP.NET 2 caused of there is no other way can replace it ?

Then why is .Net Framework saying Backward Compatibility ?
Thanks,
Tee

"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:eA**************@TK2MSFTNGP09.phx.gbl...
Hi,

in ASP.NET 2 the code-behind(beside) class is one and the same class with the dynamically created page class as they use the new partial class

feature
of the Framework 2. It also means that the Page inherits implicitly from System.Web.UI.Page.

This is error what I get when trying to have another base class:

Base class 'MyDemoClass' specified for class 'Default_aspx' cannot be
different from the base class 'System.Web.UI.Page' of one of its other
partial types.

You can do it by handling the error in global.asax.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke


"Tee" <th*@streamyx.com> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
> in ASP.NET 1.1,
>
> I created a Class, and the class Inherits System.Web.UI.Page ...
>
> I write my common error handling code there, under Protected

Overrides Sub
> OnError(ByVal e As System.EventArgs)
>
> and all my ASPX inherits the class with no problem.
>
>
> But in ASP.NET 2, how can I do the same ?
>
> I can't get my ASPX file to inherits any other thing beside
> System.Web.UI.Page ...
>
> anyone know how ?
>
>
> Thanks,
> Tee
>
>



Nov 18 '05 #5
Yeah, that was mentioned in one of the links I gave (runtime supports but
tools don't)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"Tee" <th*@streamyx.com> wrote in message
news:e%****************@TK2MSFTNGP09.phx.gbl...
Hi Teemu,

Thanks for your reply to few of my post here.

After spending sometimes in ASP.NET 2, I found that we still can inherits
another class. But we need to do this in the html source <%@ Page .....%>.

eg:
<%@ Page Inherits="Class1" Language="C#" CompileWith="Default2.aspx.cs"
ClassName="Default2_aspx" MasterPageFile="~/MasterPage.master" %>
the class to inherits must have inherited to System.Web.UI.Page or else it
will give error.
Thanks,
Tee

"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:Oa**************@TK2MSFTNGP12.phx.gbl...
Well,

remember that this is only the first beta so its not final (neither is the
compatibility). In practise there will probably be tradeoffs and the
backwards compatibility won't be perfect even though MS tries their best
with it. It is just the goal.

You might also have a look at ASp.NET 2.0 forums at ASp.NET Forums
(www.asp.net/forums)

See also these interesting threads:
http://www.asp.net/Forums/ShowPost.a...&PostID=612882
http://www.asp.net/Forums/ShowPost.a...&PostID=622319
http://www.asp.net/Forums/ShowPost.a...&PostID=627529

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"Tee" <th*@streamyx.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hi,

So do you meant I have to re-structure my code in order for it to work

in ASP.NET 2 caused of there is no other way can replace it ?

Then why is .Net Framework saying Backward Compatibility ?
Thanks,
Tee

"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:eA**************@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> in ASP.NET 2 the code-behind(beside) class is one and the same class

with
> the dynamically created page class as they use the new partial class
feature
> of the Framework 2. It also means that the Page inherits implicitly from > System.Web.UI.Page.
>
> This is error what I get when trying to have another base class:
>
> Base class 'MyDemoClass' specified for class 'Default_aspx' cannot be > different from the base class 'System.Web.UI.Page' of one of its other > partial types.
>
> You can do it by handling the error in global.asax.
>
> --
> Teemu Keiski
> MCP, Microsoft MVP (ASP.NET), AspInsiders member
> ASP.NET Forum Moderator, AspAlliance Columnist
> http://blogs.aspadvice.com/joteke
>
>
>
>
> "Tee" <th*@streamyx.com> wrote in message
> news:Oo**************@tk2msftngp13.phx.gbl...
> > in ASP.NET 1.1,
> >
> > I created a Class, and the class Inherits System.Web.UI.Page ...
> >
> > I write my common error handling code there, under Protected Overrides Sub
> > OnError(ByVal e As System.EventArgs)
> >
> > and all my ASPX inherits the class with no problem.
> >
> >
> > But in ASP.NET 2, how can I do the same ?
> >
> > I can't get my ASPX file to inherits any other thing beside
> > System.Web.UI.Page ...
> >
> > anyone know how ?
> >
> >
> > Thanks,
> > Tee
> >
> >
>
>



Nov 18 '05 #6
I had a recent post about this very issue:
http://odetocode.com/Blogs/scott/arc...06/24/286.aspx

I hope the tools will change to allow us to specify the base class in
code instead of the @Page declaration, it makes more sense that way, I
feel.

The post also addresses another issue we used to run into, which is
having an abstract class in the Page inheritance hierarchy used to
choke the VS.NET designer, but this appears to work now.

--
Scott
http://www.OdeToCode.com

On Fri, 9 Jul 2004 11:00:38 +0800, "Tee" <th*@streamyx.com> wrote:
in ASP.NET 1.1,

I created a Class, and the class Inherits System.Web.UI.Page ...

I write my common error handling code there, under Protected Overrides Sub
OnError(ByVal e As System.EventArgs)

and all my ASPX inherits the class with no problem.
But in ASP.NET 2, how can I do the same ?

I can't get my ASPX file to inherits any other thing beside
System.Web.UI.Page ...

anyone know how ?
Thanks,
Tee


Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Patrick Kowalzick | last post by:
Dear NG, I would like to change the allocator of e.g. all std::strings, without changing my code. Is there a portable solution to achieve this? The only nice solution I can think of, would be...
12
by: Arno R | last post by:
Hi there, I just distributed an application in which I (try to) change db.properties depending on CurrentUser() For instance I set the property's AllowBypassKey and AllowBuiltinToolbars to False...
3
by: Tom | last post by:
I am writing a Visual basic .Net database application. There are many forms that first let you select and look at a DB record and then when you click a "modify" button you are allowed to change...
5
by: Elena | last post by:
I need the VB.NET code to change the header/footer of an Excel spread sheet, ASAP. I am doing it through a VB application. I can change the ranges/cell values using code, but I do not know how to...
11
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RowSource of a Master Report is: Me.RowSource = "TableOrQueryName"
3
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RecordSource of a Master Report is: Me.RecordSource = "TableOrQueryName"
25
by: Peng Yu | last post by:
Hi, It is possible to change the length of "\t" to a number other than 8. std::cout << "\t"; Thanks, Peng
4
by: Heikki Toivonen | last post by:
I was debugging M2Crypto function written in C which changed behavior between Python 2.6 and earlier Python versions. In an error condition the function was supposed to raise exception type A, but...
15
by: Sunny | last post by:
Hi, I can change the lement opacity in IE using. abc.style.filter = 'alpha(opacity=' + 10 + ')'; But this dont work in firefox, In firefox it throws error. How I can change the opacity of an...
2
by: bemytthm | last post by:
I just want to ask abt communicate with AD using ASP.net. I would want to ask you all to help me correct a problem like this: This is a code i use to change password on AD public bool...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.