Is this possible in ASP.NET?

  • Thread starter Thread starter DMan
  • Start date Start date
D

DMan

I have a sequence of Webforms that each call the same class (and the same
method) to retrieve data. A code is stored in hidden fields, then
requested, and passed on to the class so the class can do formatting based
on this code.

The challenge? The code being passed along in hidden fields was just
recently added. The class interface (method signatures) CANNOT be changed
at all....the problem is that on the FIRST page where this code is actually
retrieved, it is NOT in the Request object (obviously) and I need the class
to retrieve this code even on the first page. So, Can I force something
into the Request object on the first page (since it is not submitted,
remembering that I cannot change the method signature to include the code).
Any other options?

Thanks..
 
I'm sure this has been covered before, but I'll be damned if I can find it.

So if someone could point me in the right direction I'll be grateful.

I have a contact page, where the user enters their email address some other
data, a message, etc, then they click "Send" my page then gathers all the
data and uses SmtpMail to email it to an email address I have set up. (No,
at this time I don't want to setup SQL server)

When the email is successfully sent the asp:Panel that holds the control for
the email is hidden and an asp:Panel is made visible indicating success.

This is all working great!, except...

If the user presses refresh while the success panel is displayed the email
is sent again. Also, if the user navigates away from the page then uses the
back button to get to the success message the pages is expired (that's the
way I wrote it) and presses refresh to resubmit the data, again, the email
is sent.

I'm sure I'm missing something obvious, but how do I prevent this behavior?


TIA
Brian W
 
If your neighbor calls you on the phone, can you change the number he
dialed?

You can't change the Request object, because you didn't send the Request.
The browser did. Now, I don't follow what's going on with your app, as you
haven't described fully how these pages are requested one after the other,
and I don't know anything about this class you're talking about, other than
the fact that each WebForm in your "sequence" uses it. But I can tell you
that you can't modify the Request object.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top