IsPost 判断

@{
     var world="hello world!";
     
    if(IsPost)
    {
        world="posted";
    }
   Response.Write(world);
    
}
 
<!DOCTYPE html>
 
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
        @{
            for (int i=1;i<10;i++)
            {
                
                <a href="#">@i.ToString()</a>
            }
        }
     <form method="post">
        <input type="submit" value="button"/>
        </form>
    </body>
</html>

IsPost
form method 类型需要设置为 post
posted @ 2013-10-12 16:04  不喝啤酒的小啤酒  阅读(548)  评论(0编辑  收藏  举报