Reputation: 53
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Customer/Reservation/Default.aspx
How should i fix this? If I add Default.aspx to Folder Reservation that will fix my problem but is there any way to fix this error? :)
Thanks in advance!
Upvotes: 1
Views: 4861
Reputation: 23113
I'm assuming Default.aspx
is located in the virtual directory Customer
or root and you're developing maybe a user control that has been added to a page in /Customer/Reservation
? If so, on the server-side, use ResolveUrl
Response.Redirect(ResolveUrl("~/Default.aspx"));
or to create a link from that directory in markup, use:
<a href="<% = ResolveUrl("~/Default.aspx") %>">Click here to go home</a>
However, if you're simply trying to navigate to /Customer/Reservation
with the default page set to Default.aspx
in IIS, then you'll have to add a Default.aspx
page to the virtual subdirectory.
Upvotes: 1
Reputation: 13600
You have basically two options:
Either create that file
or use routing to map that address to a desired file
.
Example of the second approach:
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
private void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("customer-reservation", // name of the route
"Customer/Reservation", // url to look for
"~/Pages/reservation.aspx"); // existing file to map to
}
Note you need at least .NET version 4 or higher if you're using webforms, or use MVC for this to work. If you're using lower .NET version and not using MVC, you'd need an url rewrite module (search for it on Google, returns plenty of results).
Note2: this example belongs inside Global.asax.cs
file.
Note3: another examples can be found here for instance: http://weblogs.asp.net/jalpeshpvadgama/archive/2011/12/11/easy-url-rewriting-in-asp-net-4-0-web-forms.aspx
If you need to find more resources on this topic, just type "asp.net routing" which shall give you enough results to learn from.
Upvotes: 0
Reputation: 4207
Just add the file. The reason it is giving you that error is because it cannot find the default document for the folder and (if I recall correctly) IIS does not by default display a listing of files within the folder.
I don't really see how you're experiencing a problem here. The error is fairly descriptive.
Upvotes: 0