how to post the data to another url without using POST method in asp.net c#?

Posted by Prabu_Spark under ASP.NET on 4/9/2014 | Points: 10 | Views : 1441 | Status : [Member] | Replies : 3
Hi sir,
Tell me the steps to post the data to another url without using POST method in asp.net c#.
Kindly give me the solution for this problem.

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: A2H on: 4/9/2014 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi,
Are you looking for a solution to pass data between pages with out using Post Method.
There are multiple ways to achieve your requirement.Please find the details given below
Using Session

An Easy solution is to use session and it will be like this\

Your PageA.aspx
//Set the value of Textbox to session
Session["Data"] = Textbox1.Text;
//Perform your Redirect
Response.Redirect("YourPageB.aspx");

YourPageB.aspx(Receiver Page)

You can read values from session like given below
 if (!String.IsNullOrEmpty(Session["Data"].ToString()))
{

//Read values from session
string valueA = Session["Data"].ToString();

}


Thanks,
A2H
My Blog

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A2H on: 4/9/2014 [Member] [MVP] Silver | Points: 25

Up
0
Down
Another option is to use QueryString to pass the values between pages
Please find the sample implementation:
Your PageA.aspx

You can pass value to pageB like given below
 protected void btnRedirect_Click(object sender, EventArgs e)
{
//Pass the value from Textbox as Query string
Response.Redirect("YourPageB.aspx?PassingValue=" + Server.UrlEncode(Textbox1.Text));
}

YourPageB.aspx(Receiver Page)
You can read the value passed through query string like given below
//Read the values from Query string
string value = Request.QueryString["PassingValue"].ToString();



Thanks,
A2H
My Blog

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A2H on: 4/9/2014 [Member] [MVP] Silver | Points: 25

Up
0
Down
You can check the below link for various other options to pass values
http://www.itorian.com/2012/07/5-ways-to-send-data-between-aspnet-pages.html

Thanks,
A2H
My Blog

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response