<%@ Page Language="C#" AutoEventWireup="true" CodeFile="hyfrcTest.aspx.cs" Inherits="views_v40_hyfrc_hyfrcTest" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    
    <%
    String oldValue = Request.Params["oldValue"];
    String encryValue ="";    if (oldValue != null)
    {
        encryValue = com.umpay.api.util.SignUtil.RSAEncrypt(oldValue);
    }
%>
</head><body>
    <form id="form1" action="hyfrcTest.aspx" runat="server">
    <div>
        <table>
            <tr>
                <td>请输入要加密的值:</td>
                <td><input type="text" name="oldValue" value="<% =Request.Params["oldValue"]%>"/></td>
                
            </tr>
            <tr>
                <td>加密后的值:</td>
                <td><textarea name="encryValue" cols="5" rows="2"><%= encryValue%> </textarea></td>
            </tr>
             <tr>
                  <th nowrap="nowrap"></th>
                  <td nowrap="nowrap"><div ><input type="submit" value="提交"  /></div></td>
                </tr>
        </table>
    </div>
    </form>
</body>
</html>“/MerPay30”应用程序中的服务器错误。编译错误说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误消息: CS0103: 当前上下文中不存在名称“encryValue”源错误:
行 29:             <tr>
行 30:                 <td>加密后的值:</td>
行 31:                 <td><textarea name="encryValue" cols="5" rows="2"><%= encryValue%> </textarea></td>
行 32:             </tr>
行 33:              <tr>源文件: d:\cworkspace\MerPay40\MerPay30\views\v40\hyfrc\hyfrcTest.aspx    行: 31 
显示详细的编译器输出:显示完整的编译源:

解决方案 »

  1.   

    那就是你没有encryValue这个组件,你只是赋值了HTML代码,但界面 与其不符
      

  2.   

    我在 c# 代码里给 encryValue 这个变量赋值了
      

  3.   

     public String encryValue ="";
    这样吗?
      

  4.   

     public String encryValue ="";
    这样吗?
    对,但是我还是建议你采用Code Behind方式,不要把服务端代码也写到aspx上
      

  5.   

     public String encryValue ="";
    这样吗?这样完全不行   
      

  6.   

     public String encryValue ="";
    这样吗?这样完全不行   

    嗯,<% %>表示代码块,这样确实是不行的,
    你还是把这个定义放到aspx.cs里吧
      

  7.   

    看似好高级的样子, 下面这段代码会生成到哪去呢? 类中? 方法中?  好像都不对啊- -<%
        String oldValue = Request.Params["oldValue"];
        String encryValue ="";
     
        if (oldValue != null)
        {
            encryValue = com.umpay.api.util.SignUtil.RSAEncrypt(oldValue);
        }
    %>
      

  8.   

     public string name = "sfasf";
            protected void Page_Load(object sender, EventArgs e)
            {
                name = "ooooo";
            }
    是可以输出ooooo的我想你肯定是在Load之外对其赋值操作,那么由于页面的解析执行顺序,你的赋值操作将无效
      

  9.   

     public String encryValue ="";
    这样吗?这样完全不行   

    嗯,<% %>表示代码块,这样确实是不行的,
    你还是把这个定义放到aspx.cs里吧
    谢谢,放到aspx.cs里吧,成功运行!
      

  10.   


    原来一直做jsp,一直用jsp的方式来写c#~~~~
      

  11.   

    额,不好说,有时候看起来一样,实际不一样呵呵,碰到无数回了,手敲滴而且看上去一模一样就是不认,你从上面copy下来就ok谁知道呢,反正不用和计算机讲道理就是了
      

  12.   

    ps:如果是混写,标准写法还是在外面套一层定义,表明是服务器端代码比较好<script type="text/C#" runat="server">
        
        </script>