Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Context RewritePath 404 Error

I have an .net 4.0 web application works like a charm at my local computer and old web server. Both computer uses classic and .net 4.0 application pool without any problems.

But when i migrated to a new web server it gives 404 error instead of rewriting urls. I created a new application as simple as it can be. It rewrites all request paths to default.aspx as seen as below:

Global.asax.cs

protected void Application_BeginRequest(object sender, EventArgs e)
{
    Context.RewritePath("default.aspx", false);
}

I can access default.aspx if i make a direct request to file itself but when i make a request to an adress except 'default.aspx' i get 404 error from static file handler.

Do you have any idea, how can i fix it?

Fullsize image here enter image description here

like image 386
Ahmet Kakıcı Avatar asked Dec 01 '25 14:12

Ahmet Kakıcı


1 Answers

You must check application pool identity settings. Make sure your web application's appPool Identity is set ApplicationPoolIdentity and Managed Pipeline Mode should be Integrated.

Then check your web config system.webserver modules and enable this configuration on your application web config.

<system.webServer><modules runAllManagedModulesForAllRequests="true"> </modules></system.webServer>
like image 58
tmesebasi Avatar answered Dec 05 '25 11:12

tmesebasi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!