在asp.net中使用经典的asp代码? [英] using classic asp code inside asp.net?

查看:74
本文介绍了在asp.net中使用经典的asp代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个同时运行经典ASP和ASP Net的应用程序.在经典的ASP页面中,我有一个组合框,并且取决于组合框的选择,我需要在asp.net页面中执行某些操作.例如,如果在我的经典ASP页面中,我有一个组合框,并且在组合框内;与选择书相比,在asp.net页面中输入书价格为零时,我应该会收到警报.有什么办法吗?

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代码

asp.net code

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

推荐答案

假设您在任何页面(html,asp)上都有一些输入控件,并且希望将某些参数传递给asp.net页面

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>

,您有一个按钮可以将帖子发布回asp.net页面,然后使用Request.Form和输入控件的名称为asp.net来获取该参数:

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"]

如果使用url参数调用页面,则需要使用某种JavaScript来动态创建该调用的URL字符串.

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.

这里的问题是,asp.net页面将无法验证页面安全性,因为它不会找到他保护页面所需的页面验证信息.

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.

这篇关于在asp.net中使用经典的asp代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆