[HttpPost]
public void insertData(string productid)
{
//insert to db
string uri = this.Url.Link("Default", new { controller = "AddProducts", action = "Index" });
//Response.Redirect(Url.Action("", ""));
}
after inserting to the database i want to redirect to an actionResult method.i have a void method, what do i return it as?
Is this an MVC controller or a web Api controller?
If MVC :
You must return an ActionResult instead of void.
Your code will look like this one.
It's your task to go deeper into details. Take a look at this one to know more about ActionResult - https://msdn.microsoft.com/en-us/library/system.web.mvc.actionresult%28v=vs.118%29.aspx
If it's a web api:
You only return Http response messages. http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/action-results