asp.net server side debugging

U

usfinecats

I'm new to asp.net. I'm trying to follow the tutorial walkthroughs and have
got a few done. Now I'm doing the one about validating input, and I've run
into some problems.

In particular, I am watching very intermittent behavior of my ASP page.

when I execute:

protected void buttonSubmit_Click(object sender, EventArgs e)
{
if(Page.IsValid) {
labelMessage.Text = "Your reservation has been processed.";
}
else
{
labelMessage.Text = "Page is not valid.";
}
}

the Page.IsValid is returning true even when it has produced errors that the
Validators have caught.

2ndly the Validator for ONE of my controls is randomly incorrect.

So, how might I debug this? The client side is not where MY PROBLEMS lie.
I need
to debug the SERVER side to understand if my properties on the validators
are not correct.

Is there caching of prior data going on that I'm not aware of?
How do I go about cleaning this out?

How do I debug this odd/frustrating behavior?

TIA
 
C

Cowboy \(Gregory A. Beamer\)

What kinds of validators are you using? If you have custom validators, you
might have an issue there, based on how they are set up.

Personally, I run data through a secondary validation on the server side to
be safe. I like having the validation in a business component, as it is
portable to other forms of application faceplates (like Windows Forms and
WPF/Silverlight). I cannot do this if all of the validation is buried in the
ASP.NET code.
 
U

usfinecats

Thanks for the reply, the validator I'm using is just the one from the
tutorial...
I forced some print statements to be dumped, and that just confirmed that
values are being cached, so I'm out of the looney bin.

I don't understand the caching though. If I fill in a form , then submit
it, then edit it and submit it again I don't find that the result is
processed correctly.

I guess I'm don't understand the execution model and when things get
processed.
Maybe a couple pointers on that would be informative.


--
Gak -
Finecats


Cowboy (Gregory A. Beamer) said:
What kinds of validators are you using? If you have custom validators, you
might have an issue there, based on how they are set up.

Personally, I run data through a secondary validation on the server side to
be safe. I like having the validation in a business component, as it is
portable to other forms of application faceplates (like Windows Forms and
WPF/Silverlight). I cannot do this if all of the validation is buried in the
ASP.NET code.
 
A

Allen Chen [MSFT]

Hi,

To learn the validation controls I suggest you follow this tutorial:

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/validation/defau
lt.aspx

From the code you provided it seems you're not using cache. So I'm not sure
if the cache will cause this problem. Could you send me a demo project that
can reproduce this issue? My email is (e-mail address removed). I'll test it
and see what the problem is.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| Thread-Topic: asp.net server side debugging
| thread-index: Ack/uzM/E3MYF/AXS9G3uitb6tgB/Q==
| From: =?Utf-8?B?dXNmaW5lY2F0cw==?= <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: asp.net server side debugging
| Date: Wed, 5 Nov 2008 18:56:00 -0800
| Lines: 91
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3168
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:79312
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks for the reply, the validator I'm using is just the one from the
| tutorial...
| I forced some print statements to be dumped, and that just confirmed that
| values are being cached, so I'm out of the looney bin.
|
| I don't understand the caching though. If I fill in a form , then submit
| it, then edit it and submit it again I don't find that the result is
| processed correctly.
|
| I guess I'm don't understand the execution model and when things get
| processed.
| Maybe a couple pointers on that would be informative.
|
|
| --
| Gak -
| Finecats
|
|
| "Cowboy (Gregory A. Beamer)" wrote:
|
| > What kinds of validators are you using? If you have custom validators,
you
| > might have an issue there, based on how they are set up.
| >
| > Personally, I run data through a secondary validation on the server
side to
| > be safe. I like having the validation in a business component, as it is
| > portable to other forms of application faceplates (like Windows Forms
and
| > WPF/Silverlight). I cannot do this if all of the validation is buried
in the
| > ASP.NET code.
| >
| > --
| > Gregory A. Beamer
| > MVP, MCP: +I, SE, SD, DBA
| >
| > Subscribe to my blog
| > http://feeds.feedburner.com/GregoryBeamer#
| >
| > or just read it:
| > http://feeds.feedburner.com/GregoryBeamer
| >
| > ********************************************
| > | Think outside the box! |
| > ********************************************
| > | > > I'm new to asp.net. I'm trying to follow the tutorial walkthroughs
and
| > > have
| > > got a few done. Now I'm doing the one about validating input, and
I've
| > > run
| > > into some problems.
| > >
| > > In particular, I am watching very intermittent behavior of my ASP
page.
| > >
| > > when I execute:
| > >
| > > protected void buttonSubmit_Click(object sender, EventArgs e)
| > > {
| > > if(Page.IsValid) {
| > > labelMessage.Text = "Your reservation has been processed.";
| > > }
| > > else
| > > {
| > > labelMessage.Text = "Page is not valid.";
| > > }
| > > }
| > >
| > > the Page.IsValid is returning true even when it has produced errors
that
| > > the
| > > Validators have caught.
| > >
| > > 2ndly the Validator for ONE of my controls is randomly incorrect.
| > >
| > > So, how might I debug this? The client side is not where MY PROBLEMS
lie.
| > > I need
| > > to debug the SERVER side to understand if my properties on the
validators
| > > are not correct.
| > >
| > > Is there caching of prior data going on that I'm not aware of?
| > > How do I go about cleaning this out?
| > >
| > > How do I debug this odd/frustrating behavior?
| > >
| > > TIA
| > >
| > >
| > >
| > > --
| > > Gak -
| > > Finecats
| >
| >
|
 
A

Allen Chen [MSFT]

Hello Larry,

Thanks for your code.

==================================================

2ndly the Validator for ONE of my controls is randomly incorrect.
==================================================

Do you mean the RangeValidator not work properly? From the code that you
sent me via email we can see:
<asp:RangeValidator ID="valNumInParty" runat="server"
ControlToValidate="textNumberInParty" Display="Dynamic"
ErrorMessage="1 to 20 plese" MaximumValue="20" MinimumValue="1"
ValidationGroup="AllValidators">num in party bad
</asp:RangeValidator>

By default the type of RangeValidator is String so some input such as 3
will be considered as invalid even though the MaximunValue is "20" and the
MinimumValue is "1". To get it work we need to set the type as integer or
double based on your requirement:

<asp:RangeValidator ID="valNumInParty" runat="server" Type="Integer"
ControlToValidate="textNumberInParty" Display="Dynamic"
ErrorMessage="1 to 20 plese" MaximumValue="20" MinimumValue="1"
ValidationGroup="AllValidators">num in party bad
</asp:RangeValidator>

==================================================

In particular, I am watching very intermittent behavior of my ASP page.

when I execute:

protected void buttonSubmit_Click(object sender, EventArgs e)
{
if(Page.IsValid) {
labelMessage.Text = "Your reservation has been processed.";
}
else
{
labelMessage.Text = "Page is not valid.";
}
}

the Page.IsValid is returning true even when it has produced errors that
the
Validators have caught.
==================================================

I cannot reproduce this issue. What I can see is the client validation for
CustomValidator1 is conflict with its server side validation.From the
following javascript we can see the input 1/1/1985 will be accepted:
<script language="javascript">
function validateDate(oSrc, args)
{
var iDay, iMonth, iYear;
var arrValues;
arrValues = args.Value.split("/");
iMonth = arrValues[0];
iDay = arrValues[1];
iYear = arrValues[2];

var testDate = new Date(iYear, iMonth - 1, iDay);
if ((testDate.getDate() != iDay) ||
(testDate.getMonth() != iMonth - 1) ||
(testDate.getFullYear() != iYear))
{
args.IsValid = false;
return;
}

return true;
}</script>

However,the server side validation only accepts the date format such as
01/01/1985:

protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{


try {
DateTime.ParseExact(args.Value, "d", CultureInfo.InvariantCulture);
//Note, use CultureInfo.InvariantCulture instead of null as the third
parameter.
args.IsValid = true;
}
catch {
args.IsValid = false;
}

So I'm not sure what should be the valid input. Could you clarify your
requirement? If you still have this problem please send me a demo and tell
me how to reproduce this issue in detail.

==================================================
PS. Why does the project end up in MyDocs...? and the sources in another
dir?
==================================================

You're creating a Web Site instead of a Web Application project. The Web
Site will keep the page files and the sln file separate.

Please let me know if you need further assistance.

Regards,
Allen Chen
Microsoft Online Support

--------------------
| Thread-Topic: asp.net server side debugging
| thread-index: Ack/uzM/E3MYF/AXS9G3uitb6tgB/Q==
| From: =?Utf-8?B?dXNmaW5lY2F0cw==?= <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: asp.net server side debugging
| Date: Wed, 5 Nov 2008 18:56:00 -0800
| Lines: 91
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3168
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:79312
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks for the reply, the validator I'm using is just the one from the
| tutorial...
| I forced some print statements to be dumped, and that just confirmed that
| values are being cached, so I'm out of the looney bin.
|
| I don't understand the caching though. If I fill in a form , then submit
| it, then edit it and submit it again I don't find that the result is
| processed correctly.
|
| I guess I'm don't understand the execution model and when things get
| processed.
| Maybe a couple pointers on that would be informative.
|
|
| --
| Gak -
| Finecats
|
|
| "Cowboy (Gregory A. Beamer)" wrote:
|
| > What kinds of validators are you using? If you have custom validators,
you
| > might have an issue there, based on how they are set up.
| >
| > Personally, I run data through a secondary validation on the server
side to
| > be safe. I like having the validation in a business component, as it is
| > portable to other forms of application faceplates (like Windows Forms
and
| > WPF/Silverlight). I cannot do this if all of the validation is buried
in the
| > ASP.NET code.
| >
| > --
| > Gregory A. Beamer
| > MVP, MCP: +I, SE, SD, DBA
| >
| > Subscribe to my blog
| > http://feeds.feedburner.com/GregoryBeamer#
| >
| > or just read it:
| > http://feeds.feedburner.com/GregoryBeamer
| >
| > ********************************************
| > | Think outside the box! |
| > ********************************************
| > | > > I'm new to asp.net. I'm trying to follow the tutorial walkthroughs
and
| > > have
| > > got a few done. Now I'm doing the one about validating input, and
I've
| > > run
| > > into some problems.
| > >
| > > In particular, I am watching very intermittent behavior of my ASP
page.
| > >
| > > when I execute:
| > >
| > > protected void buttonSubmit_Click(object sender, EventArgs e)
| > > {
| > > if(Page.IsValid) {
| > > labelMessage.Text = "Your reservation has been processed.";
| > > }
| > > else
| > > {
| > > labelMessage.Text = "Page is not valid.";
| > > }
| > > }
| > >
| > > the Page.IsValid is returning true even when it has produced errors
that
| > > the
| > > Validators have caught.
| > >
| > > 2ndly the Validator for ONE of my controls is randomly incorrect.
| > >
| > > So, how might I debug this? The client side is not where MY PROBLEMS
lie.
| > > I need
| > > to debug the SERVER side to understand if my properties on the
validators
| > > are not correct.
| > >
| > > Is there caching of prior data going on that I'm not aware of?
| > > How do I go about cleaning this out?
| > >
| > > How do I debug this odd/frustrating behavior?
| > >
| > > TIA
| > >
| > >
| > >
| > > --
| > > Gak -
| > > Finecats
| >
| >
|
 
A

Allen Chen [MSFT]

Hi Larry,

Do you have any progress on this issue? If you have further questions
please don't hesitate to let me know. I'll try my best to followup.

Regards,
Allen Chen
Microsoft Online Community Support
--------------------
| Thread-Topic: asp.net server side debugging
| thread-index: Ack/uzM/E3MYF/AXS9G3uitb6tgB/Q==
| From: =?Utf-8?B?dXNmaW5lY2F0cw==?= <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: asp.net server side debugging
| Date: Wed, 5 Nov 2008 18:56:00 -0800
| Lines: 91
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3168
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:79312
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks for the reply, the validator I'm using is just the one from the
| tutorial...
| I forced some print statements to be dumped, and that just confirmed that
| values are being cached, so I'm out of the looney bin.
|
| I don't understand the caching though. If I fill in a form , then submit
| it, then edit it and submit it again I don't find that the result is
| processed correctly.
|
| I guess I'm don't understand the execution model and when things get
| processed.
| Maybe a couple pointers on that would be informative.
|
|
| --
| Gak -
| Finecats
|
|
| "Cowboy (Gregory A. Beamer)" wrote:
|
| > What kinds of validators are you using? If you have custom validators,
you
| > might have an issue there, based on how they are set up.
| >
| > Personally, I run data through a secondary validation on the server
side to
| > be safe. I like having the validation in a business component, as it is
| > portable to other forms of application faceplates (like Windows Forms
and
| > WPF/Silverlight). I cannot do this if all of the validation is buried
in the
| > ASP.NET code.
| >
| > --
| > Gregory A. Beamer
| > MVP, MCP: +I, SE, SD, DBA
| >
| > Subscribe to my blog
| > http://feeds.feedburner.com/GregoryBeamer#
| >
| > or just read it:
| > http://feeds.feedburner.com/GregoryBeamer
| >
| > ********************************************
| > | Think outside the box! |
| > ********************************************
| > | > > I'm new to asp.net. I'm trying to follow the tutorial walkthroughs
and
| > > have
| > > got a few done. Now I'm doing the one about validating input, and
I've
| > > run
| > > into some problems.
| > >
| > > In particular, I am watching very intermittent behavior of my ASP
page.
| > >
| > > when I execute:
| > >
| > > protected void buttonSubmit_Click(object sender, EventArgs e)
| > > {
| > > if(Page.IsValid) {
| > > labelMessage.Text = "Your reservation has been processed.";
| > > }
| > > else
| > > {
| > > labelMessage.Text = "Page is not valid.";
| > > }
| > > }
| > >
| > > the Page.IsValid is returning true even when it has produced errors
that
| > > the
| > > Validators have caught.
| > >
| > > 2ndly the Validator for ONE of my controls is randomly incorrect.
| > >
| > > So, how might I debug this? The client side is not where MY PROBLEMS
lie.
| > > I need
| > > to debug the SERVER side to understand if my properties on the
validators
| > > are not correct.
| > >
| > > Is there caching of prior data going on that I'm not aware of?
| > > How do I go about cleaning this out?
| > >
| > > How do I debug this odd/frustrating behavior?
| > >
| > > TIA
| > >
| > >
| > >
| > > --
| > > Gak -
| > > Finecats
| >
| >
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top