提交的时候用
HttpUtility.HtmlEncode(string)格式话一下

解决方案 »

  1.   

    加上这一句试试
    <validateRequest=false/>;加在Web.Config 中
      

  2.   

    <validateRequest=false/>;
    用这个不大好吧
    还是用string 的Replace将敏感字符替换掉比较好
      

  3.   

    注意把一些敏感的字符replace掉
    最好的办法就是使用存储过程  或 参数方式
    我们现在写的东西,全部都是用存储过程
      

  4.   

    HttpUtility.HtmlEncode(string)
    '变为''
      

  5.   

    stpangpang(胖在一方) :注意把一些敏感的字符replace掉
    最好的办法就是使用存储过程  或 参数方式
    我们现在写的东西,全部都是用存储过程
    请问怎么使用储存过程 或是参数方式呀
    我不会用 
    请大家给我说说
    我是直接用resquest +sql语句传递数据的 
      

  6.   


    请问怎么使用储存过程 或是参数方式呀是不是在sql语句里使用 '"&strname&"' 就是参数方式呀
      

  7.   

    关于存储过程
    1、存储过程的语句怎么写?
    答:
    create procedure [dbo].[test]
    {
        @UserName int(10);
    }as
    select * from [表一] where username = @UserName
    Go
    建立一个名字叫test的存储过程
    2、存在哪里?
    答:以sqlserver为例,选中需要的数据库,然后选中存储过程
    添加新的存储过程,然后加入上述代码
      

  8.   

    3、怎么调用?
    thisConnection = new SqlConnection(@"server = CELERON\SQL2000;"+
    "integrated Security = sspi;"+"Database = Northwind");
    thisConnection.Open();
             SqlCommand cmd  = thisConnection.CreateCommand();
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.CommandText = "test";//需要的存储过程名 myPara = new SqlParameter("@UserName",SqlDbType.Int,10);//存储过程参数
    myPara.Value = logType; SqlDataReader dr = cmd.ExecuteReader();