473,508 Members | 2,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting a Reference to the WebForms from a Class

All -

What I want to do:

I want to abstract the navigation between my aspx pages into a Controlling
Class. This Class would talk to a collection of Business Objects. The
various aspx pages would make calls to the Controlling Class which would, in
turn, make the necessary calls to the Business Objects. Depending on what
page you are on and the returns from the Business Objects, the Controlling
Class will navigate the user to the correct page.

Problem I'm having:

I cannot seem to figure out how I get a reference to the context of the
pages from the Controlling Class. From the Controlling Class I am unable to
Redirect the user to another page, because I can't even get a good reference
to the Response object.

All help is appreciated.

Thanks,

- Matt

Nov 18 '05 #1
8 1638
All -

I have found the answer:
HttpContext.Current.Response.Redirect
HttpContext.Currect will give you a link to the currect page.

Thanks,

- Matt

"Matthew Sajdera" <MS******@Cox.net> wrote in message
news:eb**************@TK2MSFTNGP12.phx.gbl...
All -

What I want to do:

I want to abstract the navigation between my aspx pages into a Controlling
Class. This Class would talk to a collection of Business Objects. The
various aspx pages would make calls to the Controlling Class which would, in turn, make the necessary calls to the Business Objects. Depending on what
page you are on and the returns from the Business Objects, the Controlling
Class will navigate the user to the correct page.

Problem I'm having:

I cannot seem to figure out how I get a reference to the context of the
pages from the Controlling Class. From the Controlling Class I am unable to Redirect the user to another page, because I can't even get a good reference to the Response object.

All help is appreciated.

Thanks,

- Matt

Nov 18 '05 #2
All -

I have found the answer:
HttpContext.Current.Response.Redirect
HttpContext.Currect will give you a link to the currect page.

Thanks,

- Matt

"Matthew Sajdera" <MS******@Cox.net> wrote in message
news:eb**************@TK2MSFTNGP12.phx.gbl...
All -

What I want to do:

I want to abstract the navigation between my aspx pages into a Controlling
Class. This Class would talk to a collection of Business Objects. The
various aspx pages would make calls to the Controlling Class which would, in turn, make the necessary calls to the Business Objects. Depending on what
page you are on and the returns from the Business Objects, the Controlling
Class will navigate the user to the correct page.

Problem I'm having:

I cannot seem to figure out how I get a reference to the context of the
pages from the Controlling Class. From the Controlling Class I am unable to Redirect the user to another page, because I can't even get a good reference to the Response object.

All help is appreciated.

Thanks,

- Matt

Nov 18 '05 #3
Matthew Sajdera wrote:
All -

What I want to do:

I want to abstract the navigation between my aspx pages into a Controlling
Class. This Class would talk to a collection of Business Objects. The
various aspx pages would make calls to the Controlling Class which would, in
turn, make the necessary calls to the Business Objects. Depending on what Problem I'm having:

I cannot seem to figure out how I get a reference to the context of the
pages from the Controlling Class. From the Controlling Class I am unable to


The quick answer is to use System.Web.HttpContext.Current.Response, etc.
which gets you a reference to the current HTTP context from any class
loaded in ASP.NET.

Looks like you're looking for a more-pure J2EE kind of MVC layout.
There's an example of a .NET app written to mock J2EE, I haven't looked
at it myself, but may have a design pattern for you to follow:

http://www.gotdotnet.com/team/compare/petshop.aspx

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #4
Matthew Sajdera wrote:
All -

What I want to do:

I want to abstract the navigation between my aspx pages into a Controlling
Class. This Class would talk to a collection of Business Objects. The
various aspx pages would make calls to the Controlling Class which would, in
turn, make the necessary calls to the Business Objects. Depending on what Problem I'm having:

I cannot seem to figure out how I get a reference to the context of the
pages from the Controlling Class. From the Controlling Class I am unable to


The quick answer is to use System.Web.HttpContext.Current.Response, etc.
which gets you a reference to the current HTTP context from any class
loaded in ASP.NET.

Looks like you're looking for a more-pure J2EE kind of MVC layout.
There's an example of a .NET app written to mock J2EE, I haven't looked
at it myself, but may have a design pattern for you to follow:

http://www.gotdotnet.com/team/compare/petshop.aspx

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #5
Craig Deelsnyder wrote:
Matthew Sajdera wrote:
All -

What I want to do:

I want to abstract the navigation between my aspx pages into a
Controlling
Class. This Class would talk to a collection of Business Objects. The
various aspx pages would make calls to the Controlling Class which
would, in
turn, make the necessary calls to the Business Objects. Depending on
what


Problem I'm having:

I cannot seem to figure out how I get a reference to the context of the
pages from the Controlling Class. From the Controlling Class I am
unable to

The quick answer is to use System.Web.HttpContext.Current.Response, etc.
which gets you a reference to the current HTTP context from any class
loaded in ASP.NET.

Looks like you're looking for a more-pure J2EE kind of MVC layout.
There's an example of a .NET app written to mock J2EE, I haven't looked
at it myself, but may have a design pattern for you to follow:

http://www.gotdotnet.com/team/compare/petshop.aspx


I should say that this sample app's purpose was not to mock per se, it
was to create a comparable app for performance testing purposes. It may
or may not be modeled the same way.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #6
Craig Deelsnyder wrote:
Matthew Sajdera wrote:
All -

What I want to do:

I want to abstract the navigation between my aspx pages into a
Controlling
Class. This Class would talk to a collection of Business Objects. The
various aspx pages would make calls to the Controlling Class which
would, in
turn, make the necessary calls to the Business Objects. Depending on
what


Problem I'm having:

I cannot seem to figure out how I get a reference to the context of the
pages from the Controlling Class. From the Controlling Class I am
unable to

The quick answer is to use System.Web.HttpContext.Current.Response, etc.
which gets you a reference to the current HTTP context from any class
loaded in ASP.NET.

Looks like you're looking for a more-pure J2EE kind of MVC layout.
There's an example of a .NET app written to mock J2EE, I haven't looked
at it myself, but may have a design pattern for you to follow:

http://www.gotdotnet.com/team/compare/petshop.aspx


I should say that this sample app's purpose was not to mock per se, it
was to create a comparable app for performance testing purposes. It may
or may not be modeled the same way.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #7
Hi Matt,

Here are some further resources on the Microsoft Enterprise Design Patterns:

#Web Presentation Patterns
http://msdn.microsoft.com/library/en...PresentationPa
tterns.asp?frame=true

Hope also helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

-------------------------------------------------------------------------

Nov 18 '05 #8
Hi Matt,

Here are some further resources on the Microsoft Enterprise Design Patterns:

#Web Presentation Patterns
http://msdn.microsoft.com/library/en...PresentationPa
tterns.asp?frame=true

Hope also helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

-------------------------------------------------------------------------

Nov 18 '05 #9

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

Similar topics

1
3006
by: Martine | last post by:
Hi there! I have a problem with programmatically adding user controls to my mobile webforms. If I load my usercontrol programmatically (in the Page_Load), the object is instantiated, I have...
1
1711
by: Paul R | last post by:
Hi, I have a Winforms application that access some SQLServer2000 stored procedures. I have now written some new Webforms pages to use some of the same stored procs. The Webforms use the SAME...
4
236
by: Matthew Sajdera | last post by:
All - What I want to do: I want to abstract the navigation between my aspx pages into a Controlling Class. This Class would talk to a collection of Business Objects. The various aspx pages...
3
234
by: | last post by:
All the fields in webforms are automatically declared as protected. If I change them to public, they are converted back to protected. Why is this happening ? Thanks
3
1408
by: Billy Horne | last post by:
Hi - I need to write a basic order page for our web site. It is very straight-forward, in that we don't need a whole "shopping cart" system. Instead we just need a list of products displayed with...
2
1819
by: Simon | last post by:
Hi, Just to get started.... I've created a very simple web form, "Simple", using VS and I dropped a HTML img control on the design view. I referenced a picture and it is displayed in browser...
0
952
by: Billy Cormic | last post by:
Hi, I am new to asp.net but have done quite a bit of applications programming. I would like to create a base class webform that other webforms can inherit from. Let's say Webform1 is the base...
4
3910
by: 3Cooks | last post by:
I have a windows application written in Visual Basic 6.0 that is going to be redeveloped in dotNET. We are trying to decide if we should deploy using Webforms or Winforms and I need advice from...
5
4927
by: Bit byte | last post by:
Can I use C# (Winforms) to design a website?. I am from C/C++ background but know nothing about Internet programming. My understanding of WebForms are that they are similar to WinForms in that...
2
9468
by: =?Utf-8?B?R3lhbmVuZHJh?= | last post by:
I am using Ajax control(Update Panel) in my web page(ASP.Net 2.0) and putting Report Viewer(Sql Server Reporting Services 2005) Control in it. When I am displaying any report it is coming...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7132
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7401
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7063
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.