Click here to Skip to main content
15,906,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends

in my controller im have two action methods with same name but with different parameters.

href="url which have to call the action method"

When i am trying to have my link to call my action method it just invoking only the method with a single perameter but here i am passing two parameters.

My action methods:
public actionresult login(string Returnurl){}

another method
public actionresult login(MyModelClass model,string Returnurl){}

how can i pass the url for calling my action method. if both parameters are Strings then i am able to call the action method but here i'm having one parameter as model so when i.m assigning model object to the parameter i think there i m getting some issue over there so please how to pass a value for model parameter

please help me out.!!

thanks in advance
Updated 25-Nov-15 5:46am

1 solution

One is HttpGet method and another one is HttpPost.
In HttpPost you post the data from client side to controller. That's why that method has one parameter of type your model.
Now if you want to pass a model as a parameter, you need to use the form. You can pass the model values on submission of this form.

Refer this-[^]

And about the returnUrl, you can specify that in @Html.BeginForm(), somethng like-
@using(Html.BeginForm("action", "controller", new { returnUrl= "your url" }, FormMethod.Post, null)

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900