Fore example, to pass data between WebForm & MVC we can use the below method
protected void Link_Click(object sender, EventArgs e)
{
var httpContext = new HttpContextWrapper(Context);
var requestContext = new RequestContext(httpContext, new RouteData());
var urlHelper = new UrlHelper(requestContext, RouteTable.Routes);
Response.Redirect(
urlHelper.Action(
"Back",
"Home",
new { valuefromwebforms = "coming from WebForm1.aspx" }
)
);
}
Is the approach similar or its there a different way?
Midhun TpPosted Sep 25, 2016, 8:16 AM
You can post data to web api using jquery ajax post method. Please have a look at below articles -
http://www.c-sharpcorner.com/uploadfile/0c1bb2/inserting-asp-net-form-data-into-database-using-web-api/
Ajax get method-
http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/using-web-api-with-aspnet-web-forms