Search
Sponsor
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Forums Author
Tue, 21-Oct-2014 Authors
Shanky11
10
Vuyiswamb
10
All Time Authors
Jayakumars
4180
Karthikanbarasan
3455
Chvrsri
3140

Latest members | More ...


(Statistics delayed by 5 minutes)
 Forum Post

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

Allemahesh
Posted by Allemahesh under Others on 7/18/2013 1:51:19 PM | Points: 10 | Views : 25536 | Status : [Member] | 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.



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

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] Silver | Points: 25

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

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] Silver | Points: 25

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

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

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

Login to post response


Found interesting? Add this to: