Advertisement
Guest User

Untitled

a guest
Apr 15th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 1.24 KB | None | 0 0
  1. @{
  2.     List<string> rules = new List<string>();
  3.     Session["rules"] = rules;
  4.  
  5.     rules.Add("You do not talk about FIGHT CLUB.");
  6.     rules.Add("You DO NOT talk about FIGHT CLUB.");
  7.     rules.Add("If someone says \"stop\" or goes limp, taps out the fight is over.");
  8.     //Session.Add("rules", "You do not talk about FIGHT CLUB.");
  9.     //Session.Add("rules", "You DO NOT talk about FIGHT CLUB.");
  10.     //Session.Add("rules", "If someone says \"stop\" or goes limp, taps out the fight is over.");
  11.  
  12.     if (Request.Form["rule"] != null && Request.Form["rule"].Length > 0)
  13.     {
  14.         //rules.Add(Request.Form["rule"]);
  15.         //rules = (List<string>)Session["var"];
  16.         HttpContext.Current.Session.Add("rule", Request.Form["rule"]);
  17.        
  18.     }
  19.  
  20.     }
  21.  
  22.         <!DOCTYPE html>
  23.         <html>
  24.         <head>
  25.             <title></title>
  26.         </head>
  27.         <body>
  28.             <form action="" method="post">
  29.                 Add rule: <input type="text" name="rule"><br>
  30.                 <input type="submit" value="Submit">
  31.             </form>
  32.             <ul>
  33.                 @foreach (string rule in rules)
  34.                 {
  35.                     <li>@rule</li>
  36.                 }
  37.             </ul>
  38.         </body>
  39.     </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement