Unit test that aspx pages get routed correctly?

I have a hybrid ASP.NET MVC application, and I'd like to test that the route table properly allows my .aspx pages to be loaded. In particular I'm interested in making sure that the root of my site goes to index.aspx, not to a controller.

Update: You can test for the Ignored paths in the routing table. However, this doesn't test for the route on the root if you haven't provided a default controller. The routeData comes out null.

-------------Problems Reply------------

MvcContrib has a RouteTestingExtensions class in their TestHelper. This is how I test routes. The tests end up looking like this:

"~/computer-accessories/".ShouldMapTo<CategoryController>(x => x.Accessories());

You could try Phil Haack's route debugger, although what Craig said is correct.

Well that's easy. Root always goes to Default.aspx, even in "pure" MVC. MVC apps have a special Default.aspx to reroute to Home/Index. Yours will be a real page, instead.

Category:asp.net mvc Views:0 Time:2009-07-31

Related post

  • Is it possible to use to point to an .aspx page? 2010-02-22

    I'm trying to use an <iframe> to point to an .aspx file, but when I load it I keep getting an empty frame, no matter what is in the target .aspx nothing gets displayed. Here the html: <html xmlns="http://www.w3.org/1999/xhtml" > <head

  • Pure ASP.NET routing to a class not an aspx page 2012-01-07

    I need to do routing in an existing asp.net app - not an asp.net mvc (yeah I know I should convert but let's say it's not possible right now so don't tell me :) ) - how can I do routing to a normal class instead of an aspx page as all sample code I s

  • Cant figure out how to route my NON-MVC site from sitemap.xml to another .aspx page 2012-01-13

    When searching google the only solutions for this come up for MVC websites. My asp.net 4.0 site is not MVC. I want requests for sitemap.xml to load another dynamic .aspx page so I can generate links for google on the fly. I have spent hours searching

  • Prevent Normal Request to .ASPX pages When Implemeting URL Routing 2010-11-18

    I am using URL Routing in my .Net Web Application. I would like to prevent users from being able to access the .aspx page. Example: Actual URL - http://www.mysite.com/Testimonials.aspx Routed URL - http://www.mysite.com/Testimonials I want users to b

  • Custom ASP.NET callback-based routing; dynamic ASPX page instantiation and rendering 2012-02-15

    I'm working on a small school project, an ASP.NET C# website; we're working with a Web Application, using a Global.asax file to centralize request logic. Anyway, my colleague and I are responsible for the coding in our group, and we both come as reas

  • jQuery not showing correctly in aspx page 2011-06-01

    I'm trying to get this function to work in an aspx page but I'm having a rotten time. Basically it works fine in a regular HTML page but in the aspx page, when click on the button all you can see is a sliver of the top part and on occasion (every 5th

  • Web Service VS. Aspx Pages: Pros and Cons 2011-01-14

    We develop an ASP.Net web application that is hosted on an internal network. Currently, we have some ASPX pages that handle web requests from the client side and interact with our servers. We are starting development on our next major application ver

  • ASPX pages fail due to FIPS 140 security policy 2011-03-18

    I am working on a government site and am having some problems with my local security policy interferring with my web application. There is a setting called "System cryptography: Use FIPS 140 compliant cryptographic algorithms, including encryption, h

  • How can a master page/aspx page listen to an event that is dispatched in a usercontrol inside another usercontrol 2011-09-06

    I have a master page and an aspx page. I want each of them to listen to an event that is dispatched from a inner user control (meaning a user-control which is not in the page itself, but inside another user-control) ? Would it be easier to switch rol

  • Conditional Display in ASPX Pages on Sharepoint 2008-09-03

    I wonder what the best practice for this scenario is: I have a Sharepoint Site (MOSS2007) with an ASPX Page on it. However, I cannot use any inline source and stuff like Event handlers do not work, because Sharepoint does not allow Server Side Script

  • Html control and Server control can be used in single aspx page 2008-10-03

    I need help on this following aspx code aspx Code: <asp:Label ID ="lblName" runat ="server" Text ="Name"></asp:Label> <asp:TextBox ID ="txtName" runat ="server"></asp:TextBox> Consider this is my aspx page content. I am going

  • How to set property to Guid in aspx page 2008-10-06

    I have the following code in one of my aspx pages: <% foreach (Dependency dep in this.Common.GetDependencies(this.Request.QueryString["Name"])) { %> <ctl:DependencyEditor DependencyKey='<%= dep.Key %>' runat="server" /> <% } %

  • How to POST a FORM from HTML to ASPX page 2008-10-16

    How do I post a form from an HTML page to and ASPX page (2.0) and be able to read the values? I currently have an ASP.NET site using the Membership provider and everything is working fine. Users can log in from the Login.aspx page. We now want to be

  • Whats the best way to update an ASPX page when its child ASCX controls need to trigger a change? 2008-11-03

    When I have a child .ASCX control that needs to affect something in the parent page I'm not completely sure how I am supposed to handle the event flow in the case where I need to update something in the parent page. What I've always ended up doing is

  • Best "process" to change over plain HTML pages to ASP .NET aspx pages? 2008-11-07

    I have some pages on my site that are plain HTML pages, but I want to add some ASP .NET type functionality to these pages. My concern is that if I simple rename the .html page to .aspx that I will break links, and lose SEO, and so on. I would think t

  • How do I associate the Enter key with a button on an aspx page? 2008-12-08

    I have an asp.net ascx control file and I have put the control on an aspx page. The aspx page has a button in which when I press enter on the keyboard, I want it to fire the event handler for the button. Is there a way to set this? I am using a maste

  • Cannot set a breakpoint in aspx page running under WSS 2009-01-21

    In my SharePoint app, I deploy some aspx pages to the [12 Hive]\TEMPLATE\LAYOUTS folder. The pages are compiled in a debug mode, I'm copying both .apsx and .cs files. I used to be able to attach to w3wp.exe and set a breakpoint inside the .cs files a

  • How to set the control value in another open aspx page 2009-01-25

    My problem is simple, but I cannot find a way to solve it :( When the user clicks a specific button, I need to open a new aspx page (in a new window) so that he is able to select something that needs to be returned to the original page. I was able to

  • Getting nothing while parsing XML response from the .aspx page of VS 2005 in JQuery 2009-02-05

    I am not able to get xml response data from .aspx page of VS 2005. Following is the function which writes xml response on the client end: protected void GetMailContents(double pdblMessageID) { string lstrMailContents = ""; DataSet lobjDs = new DataSe

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.114 (s). 11 q(s)