ASP.Net/Request/Variables Passing

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Pass varaible between pages (C#)

<%@ Page Language="c#" %>
<html>
  <body>
    <%;
    string Name = "Sniff";
    string Age = "23";
    %>
    <a href="birthday2.aspx?name=<% Response.Write(Name); %>&age=<%
    Response.Write(Age); %>">Click here</a>
  </body>
</html>
<%-- 
<%@ Page Language="c#" %>
<html>
  <body>
    <center>
      <%
      string Name = Request.QueryString["Name"];
      string Age = Request.QueryString["Age"];
      %>
      <h1>Happy Birthday <% Response.Write(Name); %></h1>
      <h3>May the next
      <% Response.Write(Age); %>
      years be as good!</h3>
    </center>
  </body>
</html>
--%>