Tagged Questions
0
votes
2answers
80 views
MVC Web API route config - filter controllers in route templates
My WebApiConfig.cs Register method looks like this:
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "ClassroomContentApi",
routeTemplate: ...
0
votes
2answers
129 views
MVC 4 querystring value with period
I am implementing OAuth2 into my MVC project.
At the moment I am working with Google Api. The first step worked fine and my callback URL is being called with a parameter code which looks like this:
...
0
votes
0answers
38 views
How can i assign URL in MVC for a controller from within a class
I am creating a URL in one of my class which gets called from controller A, but my URL is for some action which is in controller B, How can get this to work, I have tried
HttpContextWrapper ...
1
vote
1answer
108 views
MVC URL RedirectToAction URl has variable and its parameter in Url
I am Redirecting my Action to another urls woth optional parameter and passing variable to the controller
RedirectToAction("action", new { a, c, s,ds});
but my urls loosk like this
...
1
vote
2answers
67 views
How to keep URL routing DRY
I want to have the option to have a route for UserName (which can change) and one for UserId. This way the user can gain the benefit of an easy to remember URL Users/{UserName} along with one that ...
0
votes
1answer
139 views
MVC link text from address bar
I have made a website with MVC and I have a little problem on routing: the link addresses from address bar appears with some strange paramaters like:
...
0
votes
1answer
60 views
Unexpected form url with mixed aspx & controller MVC .Net routes
I have two routes defined thus:
//Custom route for legacy admin page
routes.MapPageRoute(
"LocaliseRoute", // Route name
"Admin/Localise", ...
3
votes
1answer
231 views
MVC3 Site Builder Application Design
It would be great if someone could help me on this problem as I am new to web development and ASP.NET MVC. My goal is to design an MVC application which could help users to create their own mini ...
0
votes
1answer
311 views
MVC Routing : "Multiple action ids
I am having problems with my MVC Routes.
I am trying to get to the following url ... "http://localhost/api/Countries"
I have defined the following routes in the following order ...
...
1
vote
2answers
139 views
.NET MVC Routing works, except for one piece
Little help here and advice.
Working on my first MVC application and I've got an entity of Students setup.
Student Controller and views with basic CRUD capabilities.
mysite.com/Student gets me ...
2
votes
1answer
84 views
GET different url based on inputbox
I'm using the asp.net MVC pattern of having a url like controller/action/id. This works fine if I navigate to the url directly.
I want to have a page where the user can input the id and click a ...
0
votes
1answer
115 views
Remapping a URL to a MVC application
I'm remaking a website, previous build on DotNetNuke. I need to keep the database, as old URLs working.
The issue: translate the old URL
eq.
...
0
votes
0answers
89 views
MVC Custom Search Routing
I'm hoping someone can assist with a MVC 3 custom routing I am attemping to setup. Basically I have the below routes registered:
routes.MapRoute(
"Default", // Route name
...
1
vote
1answer
88 views
asp.net mvc3, need help to get this route constraint working
it works as long as the topic is all lowercase, is there a way to ignore case?
routes.MapRouteLowercase(
"TopicList", // Route name
"{topic}s/{page}", // URL with ...
1
vote
2answers
549 views
MVC ignoring CustomErrors and redirects for 404 errors
I have two websites, A and B, very similar in configuration and both running on ASP.NET MVC 3.
Both have an ErrorController and the following web.config settings for CustomErrors:
<customErrors ...
1
vote
0answers
178 views
mvc securityexception on action filter attribute
So I have this security setup on my Action using the OnActionExecuting override of the ActionFilter Attribute.
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
...
5
votes
3answers
2k views
using mvc route constraints so a url can only be mapped to one of three possible params
Here is my route:
routes.MapRoute(null,
"myaccount/monitor/{category}", // Matches
new { controller = "MyAccount", action = "Monitor", category = ...
0
votes
3answers
759 views
MVC 3 default document routing
I need to make sure that when people goes to my domain eg. mydomain.com
they get referred to the home action in the home controller, eg mydomain.com/home/home.
I can't seem to make it work using the ...
0
votes
4answers
2k views
Passing multiple values as query string is good or bad practice in MVC
In my page I ve to pass multiple values to controller.
My URL looks something like :
http://blah/Search/Page/?type=new&keywords=blahblah&sortType=Date
Is Passing multiple values as query ...
1
vote
1answer
555 views
How do I convert an object to a RouteValueDictionary inside an Action?
I need to be able to pass multiple parameters if needed into an action. They will ultimately be passed into a second action which will know the details (how many, what they are called) but my first ...
0
votes
2answers
853 views
Dynamically adding to RouteTable isnt working
I am currently writing a news article aspect to an application and I adding the new route (for the new article) to my RouteTable, which appears to add fine, but the routes are unreachable?
The code I ...
1
vote
1answer
77 views
Why doesn't this route to the default action?
So I have this route mapped:
routes.MapRoute(
"Solutions",
"{lang}/Solutions/{controller}/{action}",
new { lang="en-US", controller = "WhatWeDo", action = "Index"}
);
When I go ...
1
vote
1answer
237 views
MVC Custom Routing and Localization
Okay guys, so I've been stuck for at least 2 days, with googling and checking out all other stack articles I could find.
I just want to check to see if the first parameter in my route is a valid ...
0
votes
1answer
179 views
What is the best approach to dynamically rebuilding an live (MVC 3) Website
I do not think it matters that my question pertains to a MVC 3 website but I mention it anyway.
OK. I have a subDomain MVC 3 website in * PRODUCTION * , eg. "dowork.mydomain.com".
I am dynamically ...
4
votes
4answers
298 views
Passing parameters to Controller ..but NOT on the URL
Is there a way to pass a parameter to a controller without putting it on the URL?
For example,
http://www.winepassionate.com/p/19/wine-chianti-docg-la-moto
has the value 19 on the URL. If you ...
1
vote
2answers
4k views
Using Html.ActionLink with RouteValues
I have the following Html:
<%: Html.ActionLink(item.ProductName, "Details", "Product", new { item.ProductId }, null)%>
This is being rendered as:
<a ...
1
vote
1answer
420 views
Embedded image in portable area not showing on deployment
I am using MVC 2 on VS2010 and IIS 7. I created a portable area with some images embedded into it. I tried to create routing rule two ways at the time of portable area registeration. Following are the ...
9
votes
6answers
2k views
Routing static files in ASP.NET MVC 3 like robots.txt
I would like to have the following link "http://mywebsite.com/robots.txt" linked to a static file ~/Content/robots.txt.
How can I do this?
Thanks,
Merijn
2
votes
1answer
77 views
MVC 3 routing issue
Well, technically it is an ASP.net routing question but since I am using MVC 3 here we go.
I need to setup a route as follows:
http://www.mysite.com/profile/1 where 1 is the userid, however I want to ...
1
vote
3answers
158 views
Why doesnt this MVC routing work?
//standard routing
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = ...
0
votes
1answer
645 views
Open URL Into a View(MVC 3)
Hi I have a problem with my Application I am using the MVC 3 with C# and VS 2010.
I have a old desktop application where in one form I added a control browser_Navigated for show one page where the ...
0
votes
1answer
202 views
Caching 99% of my MVC3 pages
I have an index web page on my site. 99% of the page is the same for every user. The 1% different is the div that says "Welcome John" or "Welcome Tony". I would love to have the benefit of caching but ...
0
votes
1answer
366 views
mvc actionlink parameters change route url
so i have an actionlink line on my action
<% foreach ( var item in Model) { %>
<% Html.ActionLink (item.Name, "Profile", new { id = item.Id } )%>
<% } %>
it produces this URL, ...
2
votes
1answer
1k views
MVC IIS7 HttpContext.Current.Profile is null
I'm trying to set up my site to work with IIS7 MVC 3.
At first HttpContext.Current.User was null,
Then I removed and added models: Session, FormsAuthentication
in system.webServer Models, now ...
0
votes
2answers
188 views
Routing confusion in ASP.NET MVC
context:
I am currently developing my first MVC application, I am following the examples in the book "Pro ASP.NET MVC Framework 2" by Steven Sanderson.
I followed the first chapters and I have ...
1
vote
1answer
584 views
MVC 3 use different controllers based on request parameters
I've been scouring the web for a solution for this the past couple days and I'm not finding much. Hopefully I'm not using the right terminology and it's an easy thing to do.
I would like to use a ...
0
votes
1answer
321 views
How to remove route at runtime?
I am using a third party nuget called AttributeRouting which registeres routes using attributes. I have a unique situation and i need to remove a route from the route table on Application_Start or ...
1
vote
1answer
1k views
How can I redirect to “page not found” with MVC3?
I have some links in Google that I now no longer expect to work. All of the links look like this:
www.abc.com/xx/que=xxxxxxxxxxx
Where x can be anything.
Can someone tell me how I can set up a ...
2
votes
2answers
160 views
MVC routing problem - trying to pick up the remainder after a hyphen in the route
I created the following route:
routes.MapRoute(
"Notes 1", // Route name
"{book}-{id}", // URL with parameters
new { controller = "Notes", action = "Note", id = UrlParameter.Optional }
);
...
4
votes
3answers
3k views
MVC Controller Index sometimes 404?
I've added 3 controllers, and for one of them the Index view doesn't work by default.
Works(shows index):
http://localhost:1767/Employees/
http://localhost:1767/Employees/Index
...
5
votes
1answer
1k views
How to reuse Areas, Controllers, Views, Models, Routes in multiple apps or websites
I have a test solution which only has one area called Admin.
I would like to reuse Admin across a number of other web applications.
I have a web application setup in IIS, I have then added a virtual ...
1
vote
2answers
93 views
How to register minimum routes for similar actions?
I have some actions:
public partial class MyController : Controller
{
public ActionResult Action1()
{
}
public ActionResult Action2(int id)
{
...
1
vote
1answer
363 views
c# mvc 2 - map a catchall route for all images
I am trying to make a route to catch all image requests via regex, and use a image http handler.
I've tried adding regex's (as with routes.IgnoreRoute), however, I receive errors about the url ...
2
votes
1answer
950 views
MVC3 MapRoute problem
I created the following route:
routes.MapRoute(
"TestRoute4", // Route name
"Report {ref_id} Test Board", // URL with parameters
new { controller = "stats", action = "index" } // ...
0
votes
1answer
842 views
MVC Routes based on POST parameters
We have an a PHP application that we are converting to MVC. The goal is to have the application remain identical in terms of URLs and HTML (SEO and the like + PHP site is still being worked on). We ...
3
votes
3answers
196 views
How do you ensure your MVC routes don't conflict with each other? What tracking system do you use?
What system do you use to ensure that changes to the MVC route table does not cause conflicts, or hidden routes?
Please share details. For example, if in Excel, how do you organize it?
I am not ...
0
votes
2answers
540 views
ASP.NET MVC Area not picking up the correct route
I am in the process of debugging a routing issue on my MVC 3 application and I am using Phil Hacks routing debugger.
I cannot seem to work out where the route highlighted in yellow below is ...
1
vote
4answers
5k views
Problem returning specific view in asp.net mvc3
I have a view file structure like:
Views
Company
Department
Employee
ManageEmployee.cshtml
and the controller is
public class EmployeeController : Controller
{
public ...
3
votes
2answers
856 views
Dynamic/Editable MVC routes stored in the database for blog engine
I'm planning to write an MVC blog engine, supporting multiple blogs. When creating a blog the user will be able to choose the path where his blog will be accessed.
For example:
/blogs/firstBlog/
...
1
vote
1answer
134 views
MVC 2 Routing - {Controller}.com/{action}/{id} - Is it Possible?
We have several different domains hosted on an in-house server. They all represent different brands owned by our company and we would like integration between each domain, sharing models, views, ...