How to map multiple URL’s to the same action? [Resolved]

Posted by Allemahesh under Others on 7/18/2013 | Points: 10 | Views : 32813 | Status : [Member] [MVP] | Replies : 5
I want to map multiple URL’s to the same action in mvc3. If possible, can any one tell how to do it.




Responses

Posted by: Vuyiswamb on: 7/22/2013 [Member] [MVP] [Administrator] NotApplicable | Points: 50

Up
0
Down

Resolved
Lets say you have a hyperlink in your View that goes like this

NavigateUrl='<%#  returnURL("http://localhost:3931/Home/getData") %>'


or

NavigateUrl='<%# returnURL("http://localhost:3931/Home/Data") %>'



function string returnURL(string URL)

{
if(URL =='http://localhost:3931/Users/Data')
{
return "http://localhost:3931/Home/getData";
}
else
{
return URL;
}
}


Thank you for posting at Dotnetfunda
[Administrator]

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

Posted by: Vuyiswamb on: 7/20/2013 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Can you explain what you are trying to achieve ?


Thank you for posting at Dotnetfunda
[Administrator]

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

Posted by: Allemahesh on: 7/22/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Dear sir,

Like I have a controller name "Home" and a action method is getData().
If I call this by using

http://localhost:3931/Home/getData -> it is working.

But I want this also to be called using
http://localhost:3931/Users/Data -> how to map this URL to Home/getData.

Any help.

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

Posted by: Vuyiswamb on: 7/22/2013 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Why dont you add a Javascript that will check the URL before redirecting ?

Thank you for posting at Dotnetfunda
[Administrator]

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

Posted by: Allemahesh on: 7/22/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
I dot have any idea how to do this? Can you post some links so that I can get some idea?

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

Login to post response