I have a form that contains a mix of dynamic controls and declared controls.
All of them are intrinsic .NET controls. Several functions within the page
use Request.Form to query the value of the dynamic controls when the page is
posted back.
I also have a server side function that validates data ensuring it falls
within a given range after the post back. If the range is not valid, I am
Throw-ing a new Exception object; the validation occurs within a Try/Catch
block. The error text is written to a Label and the user is given the
opportunity to fix the value and repost the form.
When the form is reposted, the Request.Forms collection is empty and I get
"Object Reference Not Set..." errors when I try to query
Request.Form("d ynamiccontrolna me"). If I reload the page, the form attempts
to postback and I continue to get these errors.
Is this behavior by default? Why would Exceptions, if caught and the page
returned to the user in the same state, cause the collection to vanish? 2 1585
Request.Form is a collection of the name/value pairs the browser sent on the
request. the only sends them when a form.submit() is done, either thru
javascript (say a asp.net control postback), or subit bullton pressed.
the browser then sends all named, and enabled <input> and <select> controls
in the form to the server as name/value pairs.
-- bruce (sqlwork.com)
"Elliot Rodriguez" <elliotrodrigue zatgeemaildotco m> wrote in message
news:OK******** ******@tk2msftn gp13.phx.gbl... I have a form that contains a mix of dynamic controls and declared controls. All of them are intrinsic .NET controls. Several functions within the page use Request.Form to query the value of the dynamic controls when the page is posted back.
I also have a server side function that validates data ensuring it falls within a given range after the post back. If the range is not valid, I am Throw-ing a new Exception object; the validation occurs within a Try/Catch block. The error text is written to a Label and the user is given the opportunity to fix the value and repost the form.
When the form is reposted, the Request.Forms collection is empty and I get "Object Reference Not Set..." errors when I try to query Request.Form("d ynamiccontrolna me"). If I reload the page, the form attempts to postback and I continue to get these errors.
Is this behavior by default? Why would Exceptions, if caught and the page returned to the user in the same state, cause the collection to vanish?
Bruce:
I know what youre saying, but the sequence of events the way I am seeing it
should still send the collection.
1. Input made
2. Form submitted
3. Is input valid?
3a. Yes, finish processing
3b. No, Throw Exception object and give user opportunity to finish and
repost.
4. Repost form using SAME postback method
The error only occurs when I Throw an exception and attempt to reprocess the
form and I try to access values in the collection. Any other postback method
outside of that lets me access the values fine, which leads me to wonder if
on the Throw the collection is immediately cleared for some reason. My flow
of control codewise never changes - only this Throw causes the issue.
"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. .. Request.Form is a collection of the name/value pairs the browser sent on the request. the only sends them when a form.submit() is done, either thru javascript (say a asp.net control postback), or subit bullton pressed.
the browser then sends all named, and enabled <input> and <select> controls in the form to the server as name/value pairs.
-- bruce (sqlwork.com)
"Elliot Rodriguez" <elliotrodrigue zatgeemaildotco m> wrote in message news:OK******** ******@tk2msftn gp13.phx.gbl...I have a form that contains a mix of dynamic controls and declared controls. All of them are intrinsic .NET controls. Several functions within the page use Request.Form to query the value of the dynamic controls when the page is posted back.
I also have a server side function that validates data ensuring it falls within a given range after the post back. If the range is not valid, I am Throw-ing a new Exception object; the validation occurs within a Try/Catch block. The error text is written to a Label and the user is given the opportunity to fix the value and repost the form.
When the form is reposted, the Request.Forms collection is empty and I get "Object Reference Not Set..." errors when I try to query Request.Form("d ynamiccontrolna me"). If I reload the page, the form attempts to postback and I continue to get these errors.
Is this behavior by default? Why would Exceptions, if caught and the page returned to the user in the same state, cause the collection to vanish?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Iain |
last post by:
Hey folks,
(I posted this in microsoft.public.dotnet.csharp.general yesterday,
but it appears that this group is rather more lively)
For the application I am developing, I have a data access layer that
handles all the talking to the database. There are only certain
exceptions that I want to excape from this class, and all of them
should have sensible meanings - for instance, there should be a "The
database is not happy" and "There is...
|
by: Jeff |
last post by:
I'm just starting to work with UserControls and have a question on the
behavoir of exceptions within UserControls and VS.Net 2003.
I have noticed that when a UserControl throws an exception from an event
(i.e. Click event), VS.Net will enter debug mode on the exact line that
threw the exception in the UserControl. You can see the complete call stack
up to the Click event, all local variables from the Click event, etc.
However, if an...
|
by: Juan Dent |
last post by:
Hi,
How does one handle exceptions in a Web application? For
instance, I have a Page_Load method that throws an
ArgumentNullException on some ocassions and I have set
the Web.config file with a section like so:
<customErrors mode="On" defaultRedirect="ErrorForm.aspx"/>
From that page, how can I determine what kind of
|
by: Leslie |
last post by:
I am attempting to handle errors by using Application_Error. This seems to
work fine in most situations. However, if the exception occurs during the
Application_Start method, the stand error screen is displayed and my custom
error handling in Application_Error does not run.
Why does this occur, and is there something I can do to cause
Application_Error to be automatically invoked during an Application_Start
exception?
|
by: boxboy |
last post by:
Hi, I'm writing a console application and am having a problem with HttpWebRequest
when posting data to a webserver. A "System.Net.WebException: The server committed a
protocol violation" is always being thrown when getting the response from a specific
host. I'm pretty sure the framework's implementation doesn't like the formating or
status code of the returned response header. It throws the exception without giving
me a way of handling it...
| |
by: Richard Collette |
last post by:
When attempting to debug a webservice, I get the error:
Cannot serialize member System.Exception.Data of type
System.Collections.IDictionary, because it implements IDictionary.
In reading about web services
(http://msdn2.microsoft.com/en-us/library/ds492xtk.aspx), the documentation
states that exceptions will automatically be handled as a fault element in
the message and then converted to a SoapException in the client.
|
by: Steve |
last post by:
I have read a couple articles online, read my Jesse Liberty book but I am
still confused as to just what the best practices are for using exceptions.
I keep changing how I'm working with them and it has now, after 15k lines of
code resulted in a royal mess!
It's my hope to ask some specific questions with scenario examples and that
some of you might offer a little guidance or general suggestions.
1) string...
|
by: Chuck Bowling |
last post by:
In studying for the 70-316 I ran across the question below. I'm a little
confused by the 'correct' answer. Why is it necessary to wrap the Validate
method in a try/catch block? Doesn't the Exception that's thrown in the call
to Validate propagate up the call stack to the parent form without any need
to rethrow it?
==========================================
Create a component named Request. This component includes a method named
|
by: paul |
last post by:
Hi
I would like to extract all possible exceptions for a particular
method. Ideally this would be a Visual Studio 2005 Add-In and would
allow a developer to highlight a any method, pressing a shortcut key
which would result in a try/catch with all exception(s) handled.
Would someone nice out there help me on this one as this process gets
ignored by my team because it takes took long.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |