Results 1 to 3 of 3

Thread: webforms url rewriting in localhost errors

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Minnesota
    Posts
    830

    webforms url rewriting in localhost errors

    I have a site using webforms with framework 4.0. I am trying to get url rewriting to work locally. My local root appeas as follows: http://localhost:8241/sitename.com

    When I go to http://localhost:8241/sitename.com/folder1/170/ I get a 'The resource cannot be found' page.

    Here is my Global.asax code:
    Code:
    <%@ Application Language="VB" %>
    <%@ Import Namespace="System.Web.Routing" %>
    <%@ Import Namespace="System.Security.Principal" %>
    <script runat="server">
    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
            ' Code that runs on application startup
            RegisterRoutes(RouteTable.Routes)
        End Sub
    '..... other subs here removed
        Sub RegisterRoutes(ByVal routes As RouteCollection)
            routes.MapPageRoute("user-detail", _
                "folder1/{userid}/", _
                "~/folder1/user-detail.aspx")
        End Sub
    </script>
    The page I want executed is and does exist:
    /folder1/user-detail.aspx

    Control Panel > Programs > Programs and Features has IIS 8.0 Express

    Visual Studio 2010 > Tools > Options > Projects and Solutions > Web Projects has 'Use IIS Express for new file-based web sites and projects' is checked.

    Any ideas on how locally I can get url rewriting to work?

    Thanks.

  2. #2
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: webforms url rewriting in localhost errors

    Hello,

    I have just tried the exact same code that you have provided here, and it works for me :-(

    Can you confirm what version of Visual Studio you are using, and also which updates, if any, you have installed?

    Thanks

    Gary

  3. #3
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: webforms url rewriting in localhost errors

    Have you tried the url http://localhost:8241/folder1/170/ without the domain name.

    I run win server 2008 so I'm not sure about IIS express but without a DNS server localhost is finicky and I'd suggest pointing localhost:8241 to the website root folder and drop the domain name.

    In light of gep13 running the same code without error I'm thinking it's IIS, url, localhost issue
    The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width