Tagged Questions
0
votes
3answers
52 views
ASP.NET MVC routing issue
I am using asp.net mvc 4 . I want to work with 3 - 4 route pattern , but I can't . it works just with one pattern :
this is my RouteConfig file :
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
...
-2
votes
3answers
48 views
MVC - Given a route name, can I get the default action name and controller name?
Given a route name, can I get the default action name and controller name?
routes.MapRoute(
name: "MonthlyCalendar",
url: "FMB/Calendar/{jamaatName}/{year}/{month}",
defaults: new { ...
0
votes
1answer
24 views
ASP.NET MVC 4 - 301 Redirects in RouteConfig.cs
How can I add a route to the RouteConfig.cs file in an ASP.NET MVC 4 app to perform a permanent 301 redirect to another route?
I would like certain different routes to point at the same controller ...
1
vote
1answer
38 views
ASP.NET MVC 4 - Can you produce friendly URLs with an ActionLink?
I have used ActionLinks to create a page link - for example:
@Html.ActionLink(p.Name, "Details", new { URL = p.URL })
This generates a URL like this:
...
0
votes
1answer
23 views
Is their any way to have different property name in input object and different property name in the parameter to action
I have a situation where I am passing some values from query string and some values I am getting from the custom routes segment.
for example my url is
...
2
votes
1answer
22 views
Is the default area for Html.BeginForm always the current area in ASP.NET MVC?
I had the following piece of code in my Razor Layout view (which is shared by all views in my application):
@using (Html.BeginForm("Logout", "Account", FormMethod.Post, new { id = ...
1
vote
1answer
31 views
Web Api route not found
I have already researched many of the questions regarding this topic. I'm no slouch when it comes to MVC3 but for the life of me I can't figure out why my Web Api in MVC 4 routing is failing.
...
2
votes
1answer
33 views
ASP.NET MapRoute with exact match constraint
I have mapped urls in my ASP.NET application as below:
context.MapRoute(
"Product_v1_DataExchange",
"v1/xch",
new { controller = "Data", action = ...
0
votes
0answers
32 views
Standard URL tries to call a controller action
I cannot get the following link to open. It tries to call and action instead: controller /action/ www.xyz.com. It should open a new window with the url of a website outside of my application.
@if ...
1
vote
3answers
73 views
asp.net-mvc routing issue : parameters dictionary contains a null entry for parameter
I am trying to set up custom routing with the following mapped route
edit: my full route config
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: ...
2
votes
1answer
51 views
Routing a url with extension in MVC4 won't work, tries to serve up static file
I'm using MVC4 and need to route a request like this to a controller:
[myapp]/data/fileinfo.xml
Here is the route I have configured:
routes.MapRoute(
name: "Data",
url: ...
0
votes
1answer
27 views
Route Actions to same URL
I'd like to hide requests for several controllers 'create' action in a common url. The controllers all are in a sub-folder in the Controllers directory:
Controllers \ mydirectory \ controller1
...
2
votes
1answer
37 views
can not map a route for a specific controller in mvc 4
I have a controller named Registration and an action method in it as the following:
public JsonResult GetReqs(GridSettings gridSettings, int rt)
{
...//whatever
return ...
0
votes
0answers
27 views
MVC 4 routing issue
I am creating a profile site i MVC 4 and I have run into some issues with routing.
I have created a Area named Member that contains 2 Views, Profile and Message.
Routes that are registered are:
...
1
vote
2answers
59 views
MVC Double Encoding MvcHtmlString
Caveat: I have an MVC site as an area in a .Net WebForms site. I'm explaining that in advance in the case that it sheds light on my issue.
Now the issue I am having is that I am routing values that ...
0
votes
2answers
39 views
How can I return a view(model) and also pass a query string param to the view?
I have an MVC app where users fill in a 4-step form then go to a "confirm" screen. On the confirm screen, if they select to modify their info I use RedirectToAction to take them back to the first step ...
0
votes
1answer
48 views
ASP.NET MVC Routing with IIS Default Application with Alias
I am having a website, say www.mywebsite.com, to which I want to add my ASP.NET MVC application which could be accessible from the link www.mywebsite.com/MyApplication. The problem begins when the ...
0
votes
1answer
45 views
ASP.NETMVC routing looping forever
I'm quite new to MVC routing so please bear with me if this is too trivial.
I have created the following route:
routes.MapRoute("ProductSearch", ...
1
vote
2answers
47 views
How to configure routes to have default Get and named Get method in WebApiConfig?
I want to create the following API:
/api/verifications/1
/api/verifications/getfoo/1
Controller methods:
public string Get(int id)
{
return "value";
}
public string ...
1
vote
1answer
50 views
Confusion about VirtualPathProvider, bundling, embedded static files an views
I am trying to share SOME static files(css, images, scripts) and SOME views from separate libraries to few MVC applications, here is my directory structure:
Solution
Directory 1
MyContent
...
0
votes
1answer
75 views
How to access the current HttpRequestMessage object globally?
I have a method which creates an HttpResponseMessage containing an Error object which will be returned based on the current request media type formatter.
Currently, I have hardcoded the ...
0
votes
0answers
40 views
Custom file extension handling in MVC4
I'm trying to handle my specific file extensions with my custom http handler.
The dll I'm using was working perfectly for webforms, so I want to reuse it for mvc applications.
I added handlers to ...
2
votes
1answer
189 views
@Html.Action MVC 4 with QueryString Parameters
I have a question related to the Html.Action in MVC 4
I want to pass some Querystring Variables with it to the Details view
The code I have now is
System.Text.StringBuilder MobileData = new ...
1
vote
1answer
42 views
How to know when Web API Routing Engine Doesn't Find a Matching Service?
I'd like to log the requests to my Web API application that results in 404 (which means the routing engine couldn't find a matching service).
How would that be possible?
For example, if I have the ...
-1
votes
1answer
38 views
Public action method was not found on controller
I have the following controller method:
public ActionResult GetResults(string viewToReturn, int resultsPerPage,
string classification = null, string sessionId = null, int? lastId= null)
{
...
0
votes
1answer
33 views
After a change to the default routing map my actionlinks stopped working
I made a change to my routing map which is following now:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}/{title}",
defaults: new { ...
0
votes
1answer
64 views
ASP.Net MVC4 Routing not working - reserved word?
In short, I have an MVC web app that has a proxy class to marshall requests to another web app under the context of the logged in user.
This all works fine except that some of the outgoing links ...
0
votes
0answers
29 views
Attempting to 301 redirect .aspx legacy URLs using routing - not redirecting if url matches current URL pattern
I'm developing a new website and am trying to permanently redirect the old URLs to the new equivalent ones. The routing should pick up on any url including ".aspx". This is working fine, except for ...
1
vote
2answers
60 views
ASP MVC Routing - How to change the name of the default id parameter, while keeping the default route intact
In my ASP MVC web application, my controllers often have action with a "name" parameter, like this:
Function Consult(name As String) As ActionResult
.....
Return View()
End Function
I ...
0
votes
0answers
21 views
MVC RedirectToRoute Throws an error No Matching Route FOund
Im Redirecting my action Using RedirectToRoute with parametes and i defined the route in global.asax
return RedirectToRoute("RouteName", new { action = "Search", Id, Customer, ...
0
votes
2answers
42 views
MVC routing with “optional” routes
I'm a bit baffled by how MVC is figuring out my routing details. Let me see if I can explain this right.
So ... given that I have the default route ...
routes.MapRoute(
"Default",
...
2
votes
3answers
67 views
MVC 4 catch all route never reached
When attempting to create a catch all route in MVC 4 (something I've found several examples of, and based my code on) it returns a 404 error. I'm running this on IIS 7.5. This seems like a straight ...
1
vote
0answers
102 views
ASP.NET MVC 4 routing corrupting a decimal json value
I have a method in a controller:
[HttpPost]
public virtual JsonResult Add(AddItemModel request)
This receives an AJAX call. The JSON request sends a serialized version of the ...
1
vote
1answer
38 views
Why is my area routing failing for one controller but not another?
I have an MVC 4 site with the usual default routes defined (including an API route), plus an area for administration functions, which has its own route. The routing configuration looks like this:
...
0
votes
1answer
31 views
prevent users from getting partials
Angular Route:
angular.module('AMS', []).
config(['$routeProvider', function ($routeProvider) {
$routeProvider.
when('/dashboard', { templateUrl: '/Dashboard', controller: ...
0
votes
0answers
32 views
Generate virtual path but not like querystring parameter
I try to generate base url for my routes. Before my routes are this :
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
...
0
votes
1answer
143 views
The controller for path '/Home' was not found or does not implement IController
I've searched the internet high and low and checked all previously answered questions with the same title and I cannot figure this one out.
I return RedirectToAction("Index", "Home") from the ...
0
votes
1answer
29 views
Routing, hitting wrong action
I have two actions, and whenever I explicitly call the second one, the first one still gets called. I need to be able to write in mysite.com/api/Awesome/GetSomeExamples, without it always triggering ...
2
votes
1answer
43 views
How can i get an ID as parameter from an URL
I want to route the following URL;
/anything/anything-v43243-anything
How can i route this to a specific controller and action with that id as parameter?
The text "anything" has to be a text with ...
0
votes
1answer
77 views
Setting Dynamic Base Url to route to in a multi-tenant MVC website
I want to create MVC 4 Multitenand Application . My question is how can I set base url in routing.
Here are my routes :
routes.MapRoute(
name: "Default",
url: "{portal}",
...
2
votes
2answers
45 views
ASP.NET MVC routing: 404 with more than one parameter
I got a pretty basic ASP.NET MVC (1) routing qeustion but I couldn't find an answer by now.
I want to call an action method which has three parameters but I'm running into an 404 when I call it with ...
0
votes
2answers
31 views
Map legacy htm files to equivalent action
I was trying to do the following:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes){
{
//other stuff
routes.MapRoute(
name: ...
0
votes
0answers
19 views
Routing with images src in MVC 4.0
I am using MVC 4.0 and stuck in an issue of image URL routing. I have images that take their names from the db and i have stored the file physically
So now my image tag looks like
`<img ...
0
votes
3answers
40 views
Custome MVC Url Rout to display mixture of Id and UrlSlug
Hi ' I'm gonna to apply the mixture of Id and slug as a url in my blog url like this
http://stackoverflow.com/questions/16286556/using-httpclient-to-log-in-to-hpps-server
to do this I have defined ...
1
vote
1answer
265 views
ASP.NET MVC4 Routing - Multiple routes to the same location
I am in the process of setting up a Single Page Application (SPA) and would like to setup, currently two routes. For instance:
Route 1: http://localhost - this is the default route which requires ...
0
votes
2answers
37 views
ASP.Net MVC - Create Custom Routing?
I'm trying to create a custom routing. Here is what I've tried but does not work, what am I doign wrong?
Expected Call:
MyWebsite/Friend/Respond/55/4
routes.MapRoute(
name : "Friend",
...
1
vote
3answers
45 views
MVC Changing a URL route
I just watched the Pluralsight video on URL routing in ASP.NET MVC 3. I'm still a bit confused.
That image shows how my views are set up. I have a controller for each view. Perhaps I misunderstood ...
1
vote
0answers
50 views
How to set default ApiController in HttpConfiguration.Routes?
the api routing configuration from the template is this:
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DefaultApi",
...
0
votes
1answer
44 views
Routing with dashes and non-english characters
I have a specific routing need that I can't get to work. I've found quite a few answers here on StackOverflow that takes me a bit on the way, but not all the way.
Im naming my controllers and actions ...
1
vote
0answers
74 views
Error in production only when the user first hits the login screen
In production only, when the user hits our login screen we get the following elmah eror
System.NullReferenceException: Object reference not set to an instance of an object.
Generated: Wed, 24 Apr ...