Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 385415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:28:39+00:00 2026-05-12T15:28:39+00:00

I am encountering an unexpected behavior: The following statement works fine: Context.RewritePath( ~/Default.aspx );

  • 0

I am encountering an unexpected behavior:

The following statement works fine:

Context.RewritePath( "~/Default.aspx" );  // redirect to default doc, explicitly

This gives me a 404 error:

Context.RewritePath( "~/" );  // redirect to default doc, implicitly

Loading document / from a browser without doing any URL rewriting correctly loads the document, so I figure IIS is correctly configured, and that / and /Default.aspx indeed refer to the same document.

I would rather use the latter statement, as there is a possibility that the Default document name will be changed in IIS as time goes on. I’m assuming the solution involves some method to retrieve the Default Document name from IIS, however I’ve been unable to locate such a method.

So my question is: What is the correct way to specify a default document when rewriting the URL?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:28:39+00:00Added an answer on May 12, 2026 at 3:28 pm

    Your problem is that IIS handles the path translations for the “default document” before it turns control over to asp.net.

    When a browser requests a URL without a file name, IIS will check the list of “default documents” configured for that site. It then looks for physical files in the requested path that match the name of the configured default documents. It then returns the first matching default document that physically exists on the disk.

    After this, if the requested file is an asp.net file, it will invoke the asp.net runtime and hand off processing to asp.net.

    Your URL re-writing takes place inside the asp.net process. It has no awareness of IIS’s settings with regards to default documents and such. When you use a technique like URL re-writing that take place entirely within asp.net, you can’t use default documents and such. So always re-write using the page name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Unexpected behavior: I am encountering strange behavior of Oracle sequences with 11g (works with
When encountering a Debugger.Break() statement on Vista, you will get this message instead: SomeProcess.exe
This code worked fine in mvc2, but moving back to traditional ASPX (because of
I am encountering unexpected behavior with form processing, symfony 1.4 with Doctrine. I have
I am encountering a Uncaught SyntaxError: Unexpected end of input at the following code.
I'm encountering this Exception in my project using Protobuf.net: InvalidOperationException Unexpected sub-type: foo I
I am encountering this following CXF exception: warning: Interceptor for {http://example.com/wsdl/esc/2011-12-12/}AmazonEC2#{http://example.com/wsdl/esc/2011-12-12/}NewDescribeImages has thrown exception,
I am encountering an exception cause by the CFINVOKEARGUMENT line of the following snippet:
I´m encountering this problem trying to mock some objects that receive complex lambda expressions
I am encountering the following bug. I have a class Foo . Instances of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.