开发者

Post a form from asp to asp.Net

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 pos开发者_如何学编程ted 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?


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.


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.


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

https://web.archive.org/web/20210125161040/http://www.4guysfromrolla.com/webtech/070302-1.shtml

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜