asp.net-routing

Rating in asp.net mvc4 entity framework

一个人想着一个人 提交于 2019-12-11 23:33:45
问题 I am trying rating in asp.net mvc4 with entity framework, I have tried this code in cshtml but it is not working, please help me to achieve this. Its working while i am running in normal browser but it is not working while integrating into the asp.net mvc4 { <h2>rating</h2> <form method="post" id="signin" action="@Url.Action("rating", "Rating")"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="D:\My Programs\FSLIndiaLatest

Routes in areas not working in MVC / Web forms hybrid app

心不动则不痛 提交于 2019-12-11 10:28:13
问题 The app has four parts to it and 2 of them are in Areas like so (the solution is just one project fyi): /Areas/ProjectA/... /Areas/ProjectB/... The models, views, and controllers for each are nested in there. The app with loclhost works fine and all the routes behave normally. The routes do not work on the IIS server since the URL is like: https://companywebsite.com/subfolder/ The subfolder for the project is messing with the routes. The Global.asax file is like so: protected void Application

Asp.Net MVC: Reusing values for segment variables when generating outbound URLs

最后都变了- 提交于 2019-12-11 08:11:32
问题 When routes are matched to the outbound URLs , the routing system will try to find values for each of the segment variables in route's URL pattern by also looking at the values from the current request . If necessary, routing system will reuse segment variable values from the incoming URL Excerpt is from Pro Asp.Net MVC 4 book: The routing system will reuse values only for segment variables that occur earlier in the URL pattern than any parameters that are supplied to the Html.ActionLink

Is is possible to make SEO friendly Url's in ASP.NET Core like this one

有些话、适合烂在心里 提交于 2019-12-11 03:54:36
问题 I wanted to ask you guys if is it possible, to make some routing like this for my project /{action}/{title} ? I was wondering if that is possible, does this url has to be a primary key too? Since there is no ID passed to know which blog post is this. Thank you. 回答1: You can do this quite easily with attribute routing: [Route("blogs")] public class BlogController { [AcceptVerbs("GET", "HEAD", Route = "{slug}")] public IActionResult View(string slug) { } } This maps all requests to /blogs

ASP.NET MVC Hierarchy Url Routing

廉价感情. 提交于 2019-12-11 02:09:30
问题 I have a problem My route have an extra paramater after hierarchical category. /2009/World/Asia/08/12/bla-bla-bla asp.net mvc does not support this because my routing should be {year}/{*category}/{month}/{day}/{name} i tried use constraint like year = @"(\d{4})",category = @"((.+)/)+", month = @"(\d{2})", day = @"(\d{2})" but i cannot find any solution. Is there any comment? Thank you 回答1: I'm pretty sure that the route handler tokenizes on the slash character so you won't be able to have a

How do I get ASP.NET WebForms Routing to route .asmx JSON calls properly?

自古美人都是妖i 提交于 2019-12-10 22:46:40
问题 I am attempting to implement multi-tenancy in a legacy ASP.NET WebForms app. I want the URL to indicate the proper client, like so: http://example.com/client_name/Default.aspx http://example.com/client_name/MyWebService.asmx However, I cannot get it to route the .asmx's properly. This routing rule picks up all incoming urls just fine: routes.Add("ClientSelector", new System.Web.Routing.Route ( "{client}/{*path}", routeHandler: new ClientRoute() )); But I am having issues with handling .asmx

How do I configure routing for MVC and SignalR in an ASP.NET Core project?

不想你离开。 提交于 2019-12-10 16:00:05
问题 I'm trying to build a web app with ASP.NET Core 2.1.0-preview1 and ASP.NET Core SignalR 1.0.0-alpha1 with an Angular4 client. So far I've been able to muddle through and can actually open a SignalR web socket connection from within the client. That came at a price, though, here's an excerpt of my Startup.cs : app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); /*routes.MapSpaFallbackRoute( name: "spa-fallback", defaults: new {

ASP.net WebForms - Using GetRouteUrl in markup

天大地大妈咪最大 提交于 2019-12-10 10:35:43
问题 I have been trying to figure out how to use the Routing features with ASP.net 4.0 WebForms. I added a route to my route collection: void Application_Start() { RegisterRoutes(RouteTable.Routes); } void RegisterRoutes(RouteCollection routes) { routes.MapPageRoute( "about-route", "about/", "~/About.aspx" ); } In my master page I tried to do the following: <asp:HyperLink ID="asdf" runat="server" NavigateUrl='<%= GetRouteUrl("about-route", new {}) %>'>Test</asdf> I got a compiler error: Server

ASMX web services routing in ASP.NET Web Forms

风格不统一 提交于 2019-12-09 15:34:43
问题 NOTE: There is no MVC in this code. Pure old Web Forms and .asmx Web Service. I have inherited a large scale ASP.NET Web Forms & Web Service ( .asmx ) application at my new company. Due to some need I am trying to do URL Routing for all Web Forms, which I was successfully able to do. Now for .asmx , routes.MapPageRoute does not work. Based on the below article, I created an IRouteHandler class. Here's how the code looks: using System; using System.Web; using System.Web.Routing; using System

Asp.net 3.5 Sp1 Sub-Domain routing?

我的未来我决定 提交于 2019-12-08 09:53:07
问题 I was wondering is there is a way to introduce sub-domains in Asp.net 3.5 routing All i found as this http://blogs.securancy.com/post/ASPNET-MVC-Subdomain-Routing.aspx But i was looking for something more complex to allow doing wild-card sub-domains Any Help ? 回答1: Should be no problem, even with that sample. In this case, just add a wildcard to your DNS "*.yourdomain" and use the 'default' statement from the switch to handle wildcards. In other words, change the sample for the Global.asax to