473,386 Members | 1,720 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,386 software developers and data experts.

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 1633
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
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.