asp.net-routing

How do I route images through ASP.NET routing?

余生颓废 提交于 2019-12-03 08:11:36
I'd like to create a dynamic thumbnail resizer so that you can use the following URL to get a resized image: http://server/images/image.jpg?width=320&height=240 I tried setting up a route like this: routes.MapRoute(null, "{filename}", new { controller = "Image", action = "Resize" }); But if the file exists at the URL, ASP.NET will bypass the routing and return you just the file instead. How do I force ASP.NET to route the images instead of returning what's on disk? Thats how asp.net routing works, there is no away around that... you have to use Rewrite if you want to intercept requests for

Direct different IP's to different pages on IIS7

浪子不回头ぞ 提交于 2019-12-03 06:28:14
Using IIS7, how do I direct internal private network IP's addresses to my web site while I direct external IP addresses to a "site under maintenance" page? So far on IIS7 I've found the section in IIS named "IPv4 Address and Domain Restrictions" and I can add the 3 internal ranges to that as an allow range. That seems easy. Now how do I direct all other traffic to a static page such as app_offline.html that I have created. (I'm not actually going to use app_offline.html because that will obviously take the app offline for internal addresses as well.) Carlos Aguilar Mares You can use URL

How do I initialize a webhook receiver in ASP.Net MVC

99封情书 提交于 2019-12-02 11:34:30
问题 I'm following this guide here for installing and using webhooks in ASP.Net MVC, but it looks like this guide is for a wep api type project. I'm using a MVC type project and there is no Register method, unlike a API project. In MVC we have a RegisterRoutes method. So how do I register my webhooks in MVC? an API project that uses Register and config, my ASP.Net MVC site doesn't have this. MVC uses RegisterRoutes UPdate Here I added a web api controller and the code I posted below is whats in

ASP.NET routing in WebForms does not handle non-ASP extensions when running under ASP.NET Development Server

谁说胖子不能爱 提交于 2019-12-02 09:25:07
问题 I've created a default WebSite under Visual Studio 2010. Added a simple routing there into Global.asax: routes.MapPageRoute("AboutRoute", "about", "~/About.aspx"); This shows 404 when I start ASP.NET Development Server and browse to "http://localhost:6521/WebSite1/about" But works nicely when I change about to about.axd (notice the .axd extension) and browse to /WebSite1/about.axd What do I need to change in web.config to make Development Server work as IIS does (correctly handles extension

ASP.NET routing in WebForms does not handle non-ASP extensions when running under ASP.NET Development Server

本秂侑毒 提交于 2019-12-02 07:04:27
I've created a default WebSite under Visual Studio 2010. Added a simple routing there into Global.asax: routes.MapPageRoute("AboutRoute", "about", "~/About.aspx"); This shows 404 when I start ASP.NET Development Server and browse to "http://localhost:6521/WebSite1/about" But works nicely when I change about to about.axd (notice the .axd extension) and browse to /WebSite1/about.axd What do I need to change in web.config to make Development Server work as IIS does (correctly handles extension-less URLs)? This shows 404 when I start ASP.NET Development Server and browse to "http://localhost:6521

How do I initialize a webhook receiver in ASP.Net MVC

你。 提交于 2019-12-02 03:59:59
I'm following this guide here for installing and using webhooks in ASP.Net MVC, but it looks like this guide is for a wep api type project. I'm using a MVC type project and there is no Register method, unlike a API project. In MVC we have a RegisterRoutes method. So how do I register my webhooks in MVC? an API project that uses Register and config, my ASP.Net MVC site doesn't have this. MVC uses RegisterRoutes UPdate Here I added a web api controller and the code I posted below is whats in the web api controller. I included the nuget packages for webhooks, the registration in global.asax.cs

Routing on IIS6 With Decimal In Route

岁酱吖の 提交于 2019-12-02 02:30:55
I have a route in my MVC3 project that works perfectly fine locally when run through the debugger and through IIS7. However, our servers are IIS6 and when I move my application out I am getting a "The page cannot be found" error. My guess is it has to do with the decimal in the route.. So I have tried implementing a RouteHandler which seems to be getting called but is not working correctly because the value isn't overwritten in the route? Anyway, here is my route: var route = context.MapRoute( "Management_version", "Management/Version/{versionNumber}/{action}", new { area = "Management",

Force case-sensitive routing in ASP.NET MVC

拜拜、爱过 提交于 2019-12-01 08:08:11
This question has been asked in a similar but not identical fashion (and not resolved to my satisfaction) previously on Stack Overflow and elsewhere . Coming from a linux-world, I want to use ASP.NET MVC but avoid identical but differently-cased routes from resolving to the same page. I do not want to force all routes to be 100% lowercase. e.g. I want /Home/Something to be a valid route and /Home/somethingElse to also be a valid route, but not /Home/something or /home/somethingelse , given two functions called Something and somethingElse in the HomeController . I can't find any way of doing

Force case-sensitive routing in ASP.NET MVC

久未见 提交于 2019-12-01 06:47:09
问题 This question has been asked in a similar but not identical fashion (and not resolved to my satisfaction) previously on Stack Overflow and elsewhere. Coming from a linux-world, I want to use ASP.NET MVC but avoid identical but differently-cased routes from resolving to the same page. I do not want to force all routes to be 100% lowercase. e.g. I want /Home/Something to be a valid route and /Home/somethingElse to also be a valid route, but not /Home/something or /home/somethingelse , given two

ASP.Net Mvc 3 Url.Action method uses parameter values from previous request

混江龙づ霸主 提交于 2019-11-30 18:52:48
When Urls are autogenerated using the Url.Action helper, if a page contains a line similar to @Url.Action("Edit","Student") is expected to generate a url like domain/student/edit and its working as expected. But if the requested url contains some parameters, like domain/student/edit/210 , the above code uses these parameters from the previous request and generates something similar even though I've not provided any such parameter to the Action method. In short, if the requested url contains any parameters, any auto generated links of the page (served for that request) will include those