Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 629581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:45:43+00:00 2026-05-13T19:45:43+00:00

So if I have a URL such as mysite.com/user/1234/show which object can I use

  • 0

So if I have a URL such as mysite.com/user/1234/show which object can I use in the view that is displayed to get at the 1234 int in the URL above? For instance I want to have an action link that uses the user id again for the next controller action call such as mysite.com/user/1234/edit.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:45:43+00:00Added an answer on May 13, 2026 at 7:45 pm

    You shouldn’t have to go directly to the URL for the data. Instead, add a parameter to your route and action. Your route could look something like "{controller}/{id}/{action}" and your action something like:

        ViewResult Show(int userId){
          var viewData = new MyViewData(){
            UserID = userId
          };
    
          return View(viewData);
        }
    

    Then, in your view, use Model.UserID.

    EDIT: This is initially more work than just doing a (dare I write it?)

    Int32.Parse(Request["userId])
    

    in your view. However, the approach I have shown above is the preferred approach, since you will be leveraging the power of MVC’s routing and binding capabilities. If you want to change parameter name someday, you just need to fix your route and the action’s parameter name, as opposed to having to sort through all of your application searching for places where you pull values directly from the Request collection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a STRING in C# with a long url such as: http://mysite.com/testing/testingPages/area/ten/p1.aspx how
I see many, many sites that have URLs for individual pages such as http://www.mysite.com/articles/this-is-article-1
I have a URL which requires some parameters. The values of those parameters can
i have a URL http://www.mysite.com/RunReport and a controller action: [CompressFilter] public ActionResult RunReport(int field1,
I would like to have my users specify custom URL paths such that those
If I have the url mysite.com/test.php?id=1 . The id is set when the page
I have url www.test.com/test/xml in xml file have <channel> <item id=001> <title>a001</title> <actorlist> <actor>
I have url in the following types http://domain.com/1/index.php http://domain.com/2/index.php http://domain.com/3/index.php http://domain.com/4/index.php I need to
I have URL like: http://example.com#something , how do I remove #something , without causing
I have URL scheme for my blog like this: http://www.example.com/%YEAR%/%MONTH%/%CATEGORY%/%POST_TITLE%/ Now i want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.