using classic asp code inside asp.net?

匆匆过客 提交于 2019-12-25 13:17:09

问题


I have a application that running both classic asp and asp net. inside the classic asp page, I have a combo box and depends on the selection of the combo box I need to do something inside my asp.net page. For instance, if inside my classic asp page, I have a combo box and inside the combo box; book is selected than when I enter a price for book as a zero inside my asp.net page I supposed to get an alert. Is there any way to do that?

asp.net code

 if (Convert.ToDecimal(Values["myBookPrice"]) == 0)
{
 //You cannot use 0 price for books!
}

回答1:


Let say that you have some input control on any page, html, asp what ever, with some parametre that you wish to pass to an asp.net page

if the input control have a name attribute like

<form method="post" action="thenewpage.aspx">
    <input name="nameOfInput" type="text" id="idofinput" />
    <input type="submit" name="btnGo" value="Create Box" id="btnGo" />
</form>

and you have a button that make post back to an asp.net page, then you get that parametre on asp.net side using the Request.Form and the name of the input control as:

Request.Form["nameOfInput"]

If you make a call the page with url parameter, you need to use some kind of javascript to dynamically create the URL string for the call.

The issue that you have here, is that the asp.net page will hit the validation of the page security because is not going to find the page validation informations he needed to secure the page.



来源:https://stackoverflow.com/questions/20793212/using-classic-asp-code-inside-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!