url-routing

Relative URL in JQuery Post Call

久未见 提交于 2019-12-03 02:22:08
问题 I have the following situation. I developed my first MVC Asp.Net application. it runs on my server at the following adress http://localhost:59441/ I wrote some JQuery Post Methods that looked like this $.ajax({ type: "POST", url: "/CeduleGlobale/UpdateCheckBox", ... CeduleGlobale is my ControllerName and UpdateCheckBox is my methodName When I put the Application on the testServer, it was put in a VirtualDirectory hence the application is now http://testServer/JprApplication/ no more port to

Preferred client side routing solution? [closed]

和自甴很熟 提交于 2019-12-03 01:50:45
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I am designing a one page browser based web application. JQuery is already being used in my application. I am currently planning to

How do I get Route name from RouteData?

馋奶兔 提交于 2019-12-03 01:04:11
I have several routes defined in my Global.asax; When I'm on a page I need to figure out what is the route name of the current route, because route name drives my site menu. How can this be done? Unfortunately, it's not possible to get the route name of the route because the name is not a property of the Route. When adding routes to the RouteTable, the name is used as an internal index for the route and it's never exposed. There's one way to do this. When you register a route, set a DataToken on the route with the route name and use that to filter routes. The easiest way to do #1 is to

AngularJS - How do I change the State from Inside the Controller

杀马特。学长 韩版系。学妹 提交于 2019-12-02 23:23:14
I am new to AngularJS and would like to know how I change the State from within the Controller. For example, I typically change the state on a button click: <input type="submit" class="btn btn-lg btn-primary btn-block" value="Log In" ui-sref="main.navigation"/> So on Submit of the button, my page will change to the navigation page. This works fine, but what if I want to do some logic in my controller first, and then based off the results, I would want to change to a specific page. How do I do this from within the controller, versus from a button click. Here is my modules.js in case you are

How to correctly canonicalize a URL in an ASP.NET MVC application?

走远了吗. 提交于 2019-12-02 22:31:26
I'm trying to find a good general purpose way to canonicalize urls in an ASP.NET MVC 2 application. Here's what I've come up with so far: // Using an authorization filter because it is executed earlier than other filters public class CanonicalizeAttribute : AuthorizeAttribute { public bool ForceLowerCase { get;set; } public CanonicalizeAttribute() : base() { ForceLowerCase = true; } public override void OnAuthorization(AuthorizationContext filterContext) { RouteValueDictionary values = ExtractRouteValues(filterContext); string canonicalUrl = new UrlHelper(filterContext.RequestContext).RouteUrl

Change ASP.NET MVC Routes dynamically

我的梦境 提交于 2019-12-02 22:20:28
usually, when I look at a ASP.Net MVC application, the Route table gets configured at startup and is not touched ever after. I have a couple of questions on that but they are closely related to each other: Is it possible to change the route table at runtime? How would/should I avoid threading issues? Is there maybe a better way to provide a dynamic URL? I know that IDs etc. can appear in the URL but can't see how this could be applicable in what I want to achieve. How can I avoid that, even though I have the default controller/action route defined, that default route doesn't work for a

AngularJS routing vs backend routing

匆匆过客 提交于 2019-12-02 20:54:42
I would like to use AngularJS in my next project. The application with Python backend and html5, Angular frontend. I am going to use MVC framework on backend and I am little bit confused. Do I have to use routing on backend and also frontend? Because I always used backend routing and routing on frontend is really new idea for me. Is client side routing better? And when I choose to use frontend routing, there will be no routes on backend? All request will be send to one url? You can use client-side routing and let the backend return static files and JSON data. The routing in Angular basically

Routing in subdirectory in Angular.js

雨燕双飞 提交于 2019-12-02 20:33:56
Is it possible to develop an Angular.js application in a way that would be abstracted from the the web directory path in which it will be deployed? I am trying to put an Angular.js app in a web server subdirectory http://example.com/myproject/ , but the router redirects me to the web server root -- http://example.com . Below is my Angular.js app: var myproject = angular.module('myproject', []); myproject.config(function($routeProvider, $locationProvider) { $routeProvider. when('/', {templateUrl: 'partials/index.html', controller: IndexCtrl}). otherwise({redirectTo: '/'}); $locationProvider

ASP.NET MVC - MapRoute versus routes.Add (and 404s)

萝らか妹 提交于 2019-12-02 20:32:40
I'm just getting started with ASP.NET MVC. What is the difference between MapRoute and routes.Add ? Should I just be using MapRoute? Can I map multiple routes? Which "maps" take precedence... those you called first or last? I'd like to be able to do something similiar to the StackOverflow does for users. But I would like the URL to fit this pattern: "User/{domain}/{username}" to be routed to a UserController and for all other requests to do the typical ASP.NET MVC routing. ex: routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" } );

Grails - Language prefix in url mappings

若如初见. 提交于 2019-12-02 19:51:21
问题 Hi there im having problem with language mappings. The way i want it to work is that language is encoded in the url like /appname/de/mycontroller/whatever If you go to /appname/mycontroller/action it should check your session and if there is no session pick language based on browser preference and redirect to the language prefixed site. If you have session then it will display english. English does not have en prefix (to make it harder). So i created mappings like this: class UrlMappings {