routing

Namespaces equivalent in ASP.NET MVC?

*爱你&永不变心* 提交于 2019-12-10 10:28:28
问题 In rails I could create a namespace in order to encapsulate views inside a given name ( or URL prefix) What I want to do is create a namespace (or Area I believe? ) that shall encapsulate all the administrator controllers inside a given name. For example, I want to create an Admin namespace, where whenever I go to www.myapp.com/admin/ it would get the me the controller admin with the index method, and that whenever I go to www.myapp.com/admin/products it shall call the product controller with

Getting ScriptHandlerFactory handler

早过忘川 提交于 2019-12-10 10:07:41
问题 Is there any way to call System.Web.Script.Services.ScriptHandlerFactory class GetHandler method which return IHttpHandler type object. I know ScriptHandlerFactory is an internal class but is therey any other way from where I can get it? The reason I am saying is because I want to route my .asmx paths and routing needs this type of code: public IHttpHandler GetHttpHandler(RequestContext requestContext) { return new WebServiceHandlerFactory().GetHandler(HttpContext.Current, "*", _VirtualPath,

Routing in ASP.NET MVC 2.0

自闭症网瘾萝莉.ら 提交于 2019-12-10 10:06:10
问题 I'm looking to make a really simple route in my ASP.NET MVC 2.0 website. I've been googling for help but all the examples I can find are for really complex routing. Basically I want all the pages in my Home Controller to resolve after the domain as opposed to /Home/ For example I want http://www.MyWebsite.com/Home/LandingPage/ To become http://www.MyWebsite.com/LandingPage/ But only for the Home controller, I want the rest of my controllers to function as normal. I thought about creating a

Sitecore, custom MVC controllers and routes

此生再无相见时 提交于 2019-12-10 09:46:07
问题 I have a website defined in Sitecore's site definitions. The path to it is /localhost/mysite/home . And it works. I need to create a custom controller to submit forms with an API bypassing Sitecore. So I have FormsController (inheriting from MVC controller) with an action named "Test" taking no parameters. I defined the route in the initialize pipeline like this: public class Initialize { public void Process(PipelineArgs args) { MapRoutes(); GlassMapperSc.Start(); } private void MapRoutes() {

Angular: Unit Testing Routing : Expected '' to be '/route'

☆樱花仙子☆ 提交于 2019-12-10 09:36:41
问题 Am working on unit testing for my routing under my Angular app , My routes are delacred in a specific module which is imported under the app.module.ts , here is my routing module: app-routing.module.ts import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { LoginComponent } from './login/login.component'; import { WelcomeComponent } from './welcome/welcome.component'; import { CustomersListComponent } from './customer/customers-list/customers

Routing requests that end in “.cshtml” to a controller

女生的网名这么多〃 提交于 2019-12-10 08:40:55
问题 (This is cross-posted to the ASP.NET forms) I'm working on the WebGit .NET project, and we are close to a "1.0" release. However, I'm having trouble getting my "Browse" controller (which pulls files out of the repository) to serve-up ".cshtml" files. I originally had trouble with ".config" and ".cs" files as well, but I fixed that with this in the web.config: <location path="browse"> <system.webServer> <security> <requestFiltering> <fileExtensions allowUnlisted="true"> <clear /> <

ASP.NET MVC - absolute URL to content to be determines from outside controller or view

 ̄綄美尐妖づ 提交于 2019-12-10 06:49:16
问题 I have some content which is sitting in a path something like this: /Areas/MyUsefulApplication/Content/_awesome_template_bro/Images/MyImage.png Is there a way get a fully qualified absolute URL to that path without being in a controller or view (where url helpers are readily available). 回答1: You could write an extension method: public static class UrlExtensions { public static Uri GetBaseUrl(this UrlHelper url) { var uri = new Uri( url.RequestContext.HttpContext.Request.Url, url

Depth-first nested routing in an ASP.NET website

久未见 提交于 2019-12-10 06:20:07
问题 I've been exploring the System.Web.Routing namespace, playing with constraints and such, but I can't see a way to implement this. I'm working on an ASP.NET website ( non-WAP, non-MVC ) using the WebPages/Razor framework. I'm trying to implement a form of "nested routing", where a route can contain child routes that are only attempted if the parent matches; each child attempting to match the "remainder" of the URI. A "depth-first" route match search, if you will. routes.Add(new ParentRoute("

Rails no route matches with nested resources

爱⌒轻易说出口 提交于 2019-12-10 03:56:09
问题 I know this question comes up a lot with Rails, but I can't seem to get any of the previous answers to work for me. MyApplication::Application.routes.draw do resources :matters do resources :issues end I'm getting the following routing error: No route matches {:action=>"show", :controller=>"issues", :matter_id=>#<Matter id: 2, name: "Wilson", user_id: nil, created_at: "2011-03-23 18:19:40", updated_at: "2011-03-23 18:19:40">, :id=>nil} I am trying to get the path like this: <%= link_to issue

Rails create action is redirecting to index when it should be rendering the new action

一曲冷凌霜 提交于 2019-12-10 03:03:52
问题 If I submit a new user form with errors, it redirects to the index page and then renders the new page on top of it. In the controller I specify that it should just render the new action so that the user can see/fix their errors and resubmit. Is there something obvious that I am missing? Here's the create action in my controller code: def create @user = User.new(params[:user]) @user.role = "owner" if @user.save flash[:notice] = "Registration successful!" else flash.now[:notice] = "You have