I am using ASP.NET MVC 4 with Web Api
I have the following ApiController.
public class ProductsController : ApiController { public List<Product> GetProducts() { return _productService.GetAllProducts(); } public List<Product> GetProductsFromId(string username) { return _productService.GetProductsFromUsername(username); } }
Now, if you see the second GetProductsFromId(string username) action here, I need to pass in the username that previously (for example, before upgrading from MVC 3) I used User.Identity.Username to get the username.
How should I handle this in such a scenario.
How to transfer username? I can do something.
Also, I do not want to use User.Identity.Username inside the GetProductFromId(string username) method, since it will defeat the whole purpose of using the web api and will also not be verified.
Please help me with this. Thanks
source share