Appear in Online Interview to test your skills and be ready for job!
Twitter Twitter LinkedIn YouTube Google
Be Interview ready ! | Search
Submit content and win cash & prizes monthly.
Winners

Win Prizes

Announcements
Like us on Facebook
Sponsor
Top Forums Author
Thu, 24-Apr-2014 Authors
Bageshkumarbagi
10
Brierust
10
Chaithragm
10
All Time Authors
Jayakumars
3930
Karthikanbarasan
3455
Chvrsri
3140

Latest members | More ...


(Statistics delayed by 5 minutes)

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 : 24269 | 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.



Reply | Reply with Attachment

=> Scroll below for responses


Comments or Responses

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.

Comments / Responses
Select text & click toolbar to format. Formatting appears in viewmode only. HTML Tags are not allowed.
Bold Italic Underline Paragraph Title Code  Link 
 Wait ... Processing ..... please wait.

Found interesting? Add this to: