main.aspx
<body>
<form> id="form1" method="post"  runat="server">

<asp:TextBox ID="TKullanici" runat="server" Height="27px" 
                          style="text-align: left" BorderColor="Silver" BorderStyle="Solid" 
                          Font-Size="Medium" ForeColor="#999999" BorderWidth="1px"></asp:TextBox> 

<asp:TextBox ID="TSifre" runat="server" TextMode="password" Height="27px" 
                          style="text-align: left" BorderColor="Silver" BorderStyle="Solid" 
                          Font-Size="Medium" ForeColor="Gray" BorderWidth="1px">

<asp:Button ID="BGiris" runat="server" cssclass="SBGiris" Text="Giriş"  
                          onclick="BGiris_Click"  xmlns:asp="#unknown" />

                          </form>

</body>
main.aspx.cs
protected void BGiris_Click(object sender, EventArgs e)
    {

        string kullanici = TKullanici.Text;
        string sifre = TSifre.Text;
        bool kontrol=false;

        if(kullanici == "bill"&&sifre == "123")
        {
 Response.Redirect("Kullanici.aspx");
 }

 }
Kullanici.aspx.cs
protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = Request.Form["TKullanici"];
        Label1.Text += Request.Form["TSifre"];
    }
My Problem =

I want to use post method. And I want to operate first function in main.aspx.cs BGiris_Click when clicked BGiris Button.If data is true, page go to Kullanici.aspx. And Later Kullanici.aspx.cs will take data with post method. What can I do? I need some help.

If you want to post between pages, you will have to remove the runat attribute from the form element, but you'll loose the asp.net ability. You may simpy pass the parameters in your redirect using a query string or store the values in session variables. There are some other options. See this link for a high level overview. How to: Pass Values Between ASP.NET Web Pages

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.