Questions tagged [routedata]
38 questions
1
vote
1 answer
RouteDate in ASP.NET Core MVC
I have this code in ASP.NET MVC 3 and now, I'm converting it to ASP.NET Core MVC.
In the class file, I'm reading RouteData values as shown here:
public class Utilities
{
public Utilities()
{
_urlWord =…

Unknown Coder
- 1,510
- 2
- 28
- 56
1
vote
1 answer
DateTime custom Model Binder for database multilanguage routing
I have an application with a custom database routing:
routes.Add("RouteWeb", new RouteWeb());
public override RouteData GetRouteData(HttpContextBase httpContext)
{
if (httpContext.Request.IsAjaxRequest() || httpContext.Request.Url == null)…

John Mathison
- 904
- 1
- 11
- 36
1
vote
1 answer
pass RoteData to view by mvc model
I'm currently learning asp.net core, so tried to add RouteData to my mvc model and pass it to view, however when I count the number of Data values ( @Model.Data.Count ) it returns 0. I don't want to use ViewBag or @ViewContext.RouteData.Values[key]…

Payam Asefi
- 2,677
- 2
- 15
- 26
1
vote
1 answer
How to access QueryString parametr if I use Routing
I use ASP.NET Routing for pretty URLs, but I cant access QueryStringParameters (only RouteData value). I am using the routing with Web Forms.
Here is example of my RegisterRoutes (Global.asax):
routes.MapPageRoute("Catalog", "{language}/catalog/",…

Earlgray
- 647
- 1
- 8
- 31
1
vote
1 answer
ASP.NET MVC POST Parameter into RouteData
I'm using jQuery to POST an Id to my route, for example:
http://localhost:1234/Load/Delete
with a POST Parameter Id = 1
I'm only using the default route in Global.asax.cs right now:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
…

DavGarcia
- 18,540
- 14
- 58
- 96
1
vote
4 answers
Asp.Net MVC Beta: Previous RouteData overrides current RouteData?
I have something similar to the following method:
public ActionResult Details(int id)
{
var viewData = new DetailsViewData
{
Booth = BoothRepository.Find(id),
Category = ItemType.HotBuy
};
…

Gilligan
- 1,505
- 2
- 15
- 16
1
vote
1 answer
Url.RequestContext.RouteData.Values doesn't work?
I know, there are a method can be used for get current URL parameter base on route map,
Url.RequestContext.RouteData.Values["id"]
But I found when I run this method return System.NullReferenceException, so I checked in the all object got in the…

robin521
- 56
- 1
- 9
1
vote
1 answer
Get Routedata in .asmx web service on ASP.NET page
I am Using ASP.NET web forms. In my application i need to be able to get to routedata of UserName in URL.
Url looks like this: localhost/profile/MyRAndomUserNAme
There are no problems to receive it in On_Load event like this:
string userName =…

Timsen
- 4,066
- 10
- 59
- 117
0
votes
1 answer
MVC3: RouteData.Values in custom BaseController?
in my MVC3 app i have all my Controllers inherit from a custom BaseController (which in turn inherits from Controller). Is there any any way to fetch the RouteData.Values from the requested url here?

stefjnl
- 732
- 3
- 14
- 31
0
votes
1 answer
RouteValues with a ViewModel
I have a ViewModel that is a very simple filter object like this:
public class FilterViewModel
{
public String FilterTerm { get; set; }
public String FilterProperty { get; set; }
}
what I was hoping to do was to do a route link from another…

Rikon
- 2,688
- 3
- 22
- 32
0
votes
0 answers
ASP.NET MVC Core 3.1 - How to Access RouteData in a Controller
I have ASP.NET CORE 3.1 MVC application where I want to use the route data in my controller.
Similar like we do in ASP.NET MVC (not .Net Core) application.
[Permission(AuthEntity.Campaign, BusinessFunction.CanSave)]
…

Abdul Samad
- 1
- 2
0
votes
1 answer
Is there a way to route all @model data to another controller from a View in MVC?
@model IEnumerable
@if (TempData["SuccesMessage"] != null)
{
Succes! @TempData["SuccesMessage"]
}
…

Parse-Vader
- 21
- 3
0
votes
0 answers
How to get RouteData.Value in class in ASP.NET webforms
I am getting route data value in Page_Load but I want to get this value in a class.
string id = Page.RouteData.Values["id"]; // works in Page_Load
I have tried this code in a class but it didn't work. It's returning null. I don't want to check in…

Hüseyin Demir
- 1
- 1
0
votes
0 answers
RouteData not applied to HttpContext only on .NET Core 3
I want to set RouteData but changes are not applied to HttpContext.
public class LocalizeRouteAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext context)
{
…

Sauron
- 2,156
- 5
- 17
- 20
0
votes
1 answer
How to get RouteData.Values["action"].ToString() from User Attribute
[CheckAccessMethod(RouteData.Values["action"].ToString())]
[HttpGet]
public IActionResult Get(){...}
class CheckAccessMethodAttribute : Attribute
{
string MethodName { get; set; }
public …

Temir
- 1
- 1