views:

54

answers:

3

I have a classic asp application. I want to post a contest form from that page to an Asp.Net form. The reason is that I want to use a lot of logic i have built into an Asp.Net page for validation before entering into the database and I don't know asp very well. Not to mention asp.Net being more secure.

What's the best way to accomplish this goal? My thoughts are as follows:

My asp Page:

<html>
  <body>
    <form action="/Contests/entry.aspx" method="post">
      Name: <input type="text" name="fname" size="20" />
      Last Name: <input type="text" name="lname" size="20" />
      <input type="submit" value="Submit" />

    </form>
  </body>
</html>

aspx page is running in a Virtual Directory and would handle anything posted to it.

Is this possible, or does aspx prevent this kind of thing?

I ( preferably ) don't want to create the form in aspx as my colleague wants to have control of the page and build the html himself and I don't want the hassle of constantly changing it.

Are there caveats I need to consider?

What roadblocks will I run into?

How do I access the Posted Form Values? Request.Form?

+2  A: 

How about calling an ASP.NET webservice from classic asp?

http://www.4guysfromrolla.com/webtech/070302-1.shtml

Raj Kaimal
Good suggestion. It's not a preferable option this case, as I want to avoid writing any asp code for this legacy site.The marketing team wants to add a contest while we're waiting for our new asp.net site to launch and I want to enable them to just write a basic html form and post it to me to handle the data.
Atømix
+5  A: 

Yes it is possible. In general, a POST is a POST. So you can post from a PHP page to a .NET page if you wanted. You would access the Request.Form variables just as you do now. You will have to look at the ASP Classic page to see the names of the post items but in general, you can access them as if you had pasted from .NET page.

Thomas
This is good to know. For some reason I thought Asp.Net did some security validation to ensure that what's getting posted says it is what it is.
Atømix
+2  A: 

This can be done and works fine. You will access the Posted Form values as you said via Request.Form.

I think the biggest caveat is that you will need to handle invalid data in some way - typically with a webform the .aspx page would be displayed again with validation errors, but that would likely be inappropriate for your circumstance. Probably you will need to redirect them back to the .asp page with query string parameters indicating the failures and the page will need code allowing it to fill in the form fields with their previous values and display the error message.

Chris Shaffer
Yeah, I was thinking about this as well.
Atømix
In the end... having easy to implement client-side data validation (easy to do in .Net) outweighed the time saved in just working with post values. I experimented with the javascript query error... but decided against it. too much trouble to implement. Thanks for the post.
Atømix