Hi,
I'm trying to move all my custom validation code into the master
page. Unfortunately anytime I use the response, request, or trace
objects in any master page module (other than page_load), " Object
reference not set to an instance of an object." is the error I
receive.
Below is a sample of code that will not work on my web server. Any
suggestions/advice are appreciated.
Thanks.
Debug.aspx.vb (btnGo - is a web control object in Default.aspx)
Partial Class Debug
Inherits System.Web.UI.P age
Protected Sub btnGo_Command(B yVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Comm andEventArgs) Handles btnGo.Command
Dim objMaster As New DebugMaster
With objMaster
.CheckResponseO bject()
End With
End Sub
End Class
DebugMaster.Mas ter.Vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Response.Write( "Inside the Master Page - Page_Load event
handler")
End Sub
Public Sub CheckResponseOb ject()
Response.Write( "Inside the Master Page - CheckResponseOb ject
method")
End Sub
----------------------
On load the Master Page's page load "Response.Write " works, however
when the btnGo event is called (thus calling CheckResponseOb ject), the
page returns an " Object reference not set to an instance of an
object." exception.
Similar errors are called when I use the request or trace objects as
well.
Any advice on how to resolve would be greatly appreciated.
Thanks,
Mike 6 3541
<mi**********@j ccteam.comwrote in message
news:e5******** *************** ***********@s19 g2000prg.google groups.com...
In addition to Peter's response, I'm slightly curious as to what you're
trying to achieve here...
There's no need to use Response.Write in ASP.NET - just put a breakpoint
where you would like your code to break, and hit the button...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
To help the debug process, enable tracing for your application and use
Trace.Write() to output messages to the trace log for testing. It's much
more powerful than the old Response.Write method of dumping variables and
hints at different points in the page.
--
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
<mi**********@j ccteam.comwrote in message
news:e5******** *************** ***********@s19 g2000prg.google groups.com...
Hi,
I'm trying to move all my custom validation code into the master
page. Unfortunately anytime I use the response, request, or trace
objects in any master page module (other than page_load), " Object
reference not set to an instance of an object." is the error I
receive.
Below is a sample of code that will not work on my web server. Any
suggestions/advice are appreciated.
Thanks.
Debug.aspx.vb (btnGo - is a web control object in Default.aspx)
Partial Class Debug
Inherits System.Web.UI.P age
Protected Sub btnGo_Command(B yVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Comm andEventArgs) Handles btnGo.Command
Dim objMaster As New DebugMaster
With objMaster
.CheckResponseO bject()
End With
End Sub
End Class
DebugMaster.Mas ter.Vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Response.Write( "Inside the Master Page - Page_Load event
handler")
End Sub
Public Sub CheckResponseOb ject()
Response.Write( "Inside the Master Page - CheckResponseOb ject
method")
End Sub
----------------------
On load the Master Page's page load "Response.Write " works, however
when the btnGo event is called (thus calling CheckResponseOb ject), the
page returns an " Object reference not set to an instance of an
object." exception.
Similar errors are called when I use the request or trace objects as
well.
Any advice on how to resolve would be greatly appreciated.
Thanks,
Mike
Thanks to all for responding to my post and on a Saturday! In an
effort to make my example simple, I rewrote it using only one
response.write statement. In reality, I'm actually trying to call
Request.Browser .Cookies (as part of my validation routine). I'm not,
nor do I in practice, using response.write in my code ;-).
Neither the response, request, or trace objects work. All return the
"Object reference not set to an instance of an object." exception.
I will read the link provided.
Again, thank you.
The Response object is actually a shortcut. When you have a normal page, the
System.Web.UI.P age class basically let's you use Response, Request, etc.
because it's actually giving you a shortcut to the real class. Anywhere
outside of a page (and this includes a MasterPage because it inherits from a
different base clase) you need to use HttpContext.Cur rent.Response or
HttpContext.Cur rent.Request. Then you can get at the objects and properties
you want. The same goes for things like the Session and Server objects as
well.
--
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
<mi**********@j ccteam.comwrote in message
news:e5******** *************** ***********@s19 g2000prg.google groups.com...
Hi,
I'm trying to move all my custom validation code into the master
page. Unfortunately anytime I use the response, request, or trace
objects in any master page module (other than page_load), " Object
reference not set to an instance of an object." is the error I
receive.
Below is a sample of code that will not work on my web server. Any
suggestions/advice are appreciated.
Thanks.
Debug.aspx.vb (btnGo - is a web control object in Default.aspx)
Partial Class Debug
Inherits System.Web.UI.P age
Protected Sub btnGo_Command(B yVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Comm andEventArgs) Handles btnGo.Command
Dim objMaster As New DebugMaster
With objMaster
.CheckResponseO bject()
End With
End Sub
End Class
DebugMaster.Mas ter.Vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Response.Write( "Inside the Master Page - Page_Load event
handler")
End Sub
Public Sub CheckResponseOb ject()
Response.Write( "Inside the Master Page - CheckResponseOb ject
method")
End Sub
----------------------
On load the Master Page's page load "Response.Write " works, however
when the btnGo event is called (thus calling CheckResponseOb ject), the
page returns an " Object reference not set to an instance of an
object." exception.
Similar errors are called when I use the request or trace objects as
well.
Any advice on how to resolve would be greatly appreciated.
Thanks,
Mike
Mark,
Thanks for the reply. I implemented your logic using the full name
and it worked!
The one thing I don't understand (and probably never will) is why the
"shortcut" response/request worked in the master page's page_load.
Again thanks, you saved many a headache... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paul Turley |
last post by:
I have a string (or byte array) containing an entire page definition not
contained in a file ("<htm><head>...</head><body>...</body></html>") that I
need to render when the user clicks a button. Can I send this string to the
Reponse object? This "page" is the response.
FYI, this is the content returned by the SQL Reporting Services web service.
--
Paul Turley, MCSD, MCDBA, MCAD, MSF, MCT, Project+, A+
paul@scout-master.(com - remove...
|
by: George G. |
last post by:
Hi there,
I am busy writing a new asp.net application and I am reusing some of my
existing asp functions and methods in a user control. I need access to
session, request and response in some of the functions and I can't find out
how to do it. Here is an example of what I do and I get the following
Cannot refer to an instance member of a class from within a shared method or
shared member initializer without an explicit instance of the...
|
by: Alan Silver |
last post by:
Hello,
I have a page where site owners can see orders placed on their site. The
path to this page is /dap/order.aspx, but for security reasons (as they
will end up printing these pages and sending them to customers) I am
trying to rewrite the path so the URL shown in the page footer is not a
real one.
I want to use an URL like http://www.domain.com/order123.aspx and have
it rewritten to http://www.domain.com/dap/order.aspx?orderid=123
|
by: Sam |
last post by:
Folks, Attached I am sending 2 URL's from MSFT ASP.net Quick Start
Tutorial Web Site.
1) Run it URL:
http://www.asp.net/QuickStart/aspnet/samples/data/GridViewMasterDetailsInsertPage_vb.aspx
2) View Source URL:
http://www.asp.net/QuickStart/util/srcview.aspx?path=~/aspnet/samples/data/GridViewMasterDetailsInsertPage.src
I do understand from the Master Page
(GridViewMasterDetailsInsertPage_vb.aspx) the last field from Gridview1
|
by: Sam |
last post by:
Attached I am sending 2 URL's from MSFT ASP.net Quick Start
Tutorial Web Site.
1) Run it URL:
http://www.asp.net/QuickStart/aspnet/samples/data/GridViewMasterDetai...
2) View Source URL:
http://www.asp.net/QuickStart/util/srcview.aspx?path=~/aspnet/samples...
| |
by: Sam |
last post by:
Sorry to post the same post multiple times but the URL Addresses were
not Correct in Earlier Posts.
Here are the correct URL's:
1) Run It URL is here:
http://www.asp.net/QuickStart/aspnet/samples/data/GridViewMasterDetailsInsertPage_vb.aspx
|
by: D |
last post by:
Hi
I'm obviously still learning here but what I've created is a page with a
calendar and button. When I click the button I do a number of tasks and
would like to output the progress in messages such as
Starting TaskA
Processing TaskA
Completed TaskA
|
by: Michael D. Ober |
last post by:
When I single step through the code below, it sends back the PDF file that
is retrieved in the line fm.GetAccountPDF(...). When I run without single
stepping, I get the master page for this page. I have actually saved the
file returned by IE 7 as a text file and opened it in notepad, so I have
confirmed that it is indeed the page master being returned. The code is in
the code behind file for the aspx page and is called directly from a...
|
by: AbleJames |
last post by:
I have the following code in a Master Page code behind as a link (ADA is a class I dim for this page): Protected Sub selectOrg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles selectOrg.Click
'navigation bar
ADA.SmartRedirect("AnnaChooseContact.aspx?retain=true")
End SubIn the ADA class which inherits from System.Web.UI.Page I have: Public Function SmartURL(ByVal Destination As String) As String
If...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |