routing

Multiple Controllers with one Name in ASP.NET MVC 2

放肆的年华 提交于 2019-11-30 22:59:08
问题 I receive the following error when trying to run my ASP.NET MVC application: The request for 'Account' has found the following matching controllers: uqs.Controllers.Admin.AccountController MvcApplication1.Controllers.AccountController I searched the project for MvcApplication1.Controllers.AccountController to remove it, but I can't find a match. I try to registered a route to fix it: routes.MapRoute( "LogAccount", // Route name "{controller}/{action}/{id}", // URL with parameters new {

Routing Classic ASP Requests To .NET - SEO Redirects

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 22:48:45
We are replacing an old classic asp website with a .NET 3.5 solution. We need to redirect all of the classic ASP requests to aspx pages (i.e. contactus.asp, may now route to /contact-us/default.aspx). What I woudl like is for the requests to hit global.asax so I can do something like If url == "bob.asp" Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", SiteConfig.SiteURL + redirectUrl); End If There are two inelegant solutions. A) Place a global.asa file and do the routing through that. B) Map asp files to the .NET engine. Great, but then if we need to host classic asp

ASP.Net MVC route mapping

≡放荡痞女 提交于 2019-11-30 22:36:23
问题 I'm new to MVC (and ASP.Net routing). I'm trying to map *.aspx to a controller called PageController . routes.MapRoute( "Page", "{name}.aspx", new { controller = "Page", action = "Index", id = "" } ); Wouldn't the code above map *.aspx to PageController ? When I run this and type in any .aspx page I get the following error: The controller for path '/Page.aspx' could not be found or it does not implement the IController interface. Parameter name: controllerType Is there something I'm not doing

How can we make an ASP.NET MVC4 route based on a subdomain?

时光怂恿深爱的人放手 提交于 2019-11-30 22:01:25
问题 How can we make an ASP.NET MVC4 route that uses subdomain information to determine its route? For example: website1.domain.com goes to domain.com\websites\1 website2.domain.com goes to domain.com\websites\2 This is a dynamic mapping like this: websiteN.domain.com goes to domain.com\websites\N I have a username parameter,How Can I pass through controller/action? 回答1: ASP.NET's built-in routing doesn't directly support sub-domain routing. But fortunately, there's AttributeRouting, which is a

How to redirect Homepage.aspx to an MVC default route?

我只是一个虾纸丫 提交于 2019-11-30 21:40:16
问题 We're developing a new system to replace an existing system. The new system is ASP.NET MVC so we're defining routes to our controllers and actions as normal. The old system as traditional ASP.NET so the URLs consist of lots of .aspx pages. We want to set up redirects so that when a user tries to access /Homepage.aspx (lots of users would have that bookmarked), they'll get redirected to the new system's default route, which is just / What is the best way for me to do this? edit: @Chance

Routing in Symfony2: optional parameter en four urls for one route

青春壹個敷衍的年華 提交于 2019-11-30 21:18:06
In my Symfony2 application I would like to make four urls possible with one route: a-lot-of-other-stuff/report/-20 (negative number) a-lot-of-other-stuff/report/40 (positive number) a-lot-of-other-stuff/report/ (no number) a-lot-of-other-stuff/report (no number and no / ) My route currently looks like this: report: pattern: /report/{days} defaults: { _controller: "AppReportBundle:Report:dayReport", days = null } The action is defined as: public function dayReportAction($days = null) { // my code here } This currently makes url 1 and 2 working but in the case of url 3 and 4, I get an error

Defining two get function in WebAPI

寵の児 提交于 2019-11-30 21:14:02
问题 I am getting to following exception when i am trying to call a GET function in MVC WebAPI {"$id":"1","Message":"An error has occurred.", "ExceptionMessage":"Multiple actions were found that match the request: \r\nSystem.Xml.XmlNode Get(Int32, System.String) I think the problem is cause due to two get function I have defined two functions: One: [HttpGet] public XmlNode Get(int id, string Tokken) { //Do something } Second One [HttpGet] public List<UsersAnswers> GetUsersInteractions(int?

Is there a C/C++ API to the route information on Windows?

夙愿已清 提交于 2019-11-30 21:10:56
Is there a windows or cygwin C/C++ API to collect information provided by the route command on Windows? I'm specifically interested in the route metrics. Here's an example of what route outputs, the IPs have been changed to protect the innocent. $ route PRINT -4 =========================================================================== Interface List 11...64 31 50 3b ba 96 ......Broadcom NetXtreme Gigabit Ethernet 17...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1 18...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8 1...........................Software

Codeigniter isn't routing right

杀马特。学长 韩版系。学妹 提交于 2019-11-30 20:59:07
I installed Apache for Windows. I bought CodeIgniter Professional and downloaded their source code. It said that I should put its .htaccess in the root folder of the website so I did. I set base URL to be http://127.0.0.1/kids/ where kids is the root folder of the website. It showed the homepage just fine. When I clicked on a link, it always gives the 404 error. It said, "The requested URL /index.php/welcome/cat/2 was not found on this server." I tried several possiblities of .htaccess in directories with no success. Inside the .htaccess, it instructs: RewriteEngine on RewriteCond $1 !^(index\

Express.js: how to make app.get('/[:userId]i'..) in req.param?

核能气质少年 提交于 2019-11-30 20:57:12
I m using nodejs 0.8.21 and express 3.1.0 I need to read userId from url like http://mysite.com/39i . It means userId=39 . How to do? Thank you. Sample: app.get('/:userId_i', function(req, res) { }); app.param('userId', function(req, res, next, id){ }); travis Assuming you have a numerical id followed by an i and you want the id coming back as just the numerical. app.get("/:id([0-9]+)i", function (req, res) {...}); This will match a numeric followed by an i and will give you just the numeric in req.params.id . Example: curl -XGET localhost:8080/124i Gives me the following in req.params [ 'id':