Resource.axd syntax error

I am using Rewriting URLs with an ASP.NET website that does not use MVC. The site is working fine, and until today I had no problems when I started to get 2 errors. According to FireBug, both errors are on line 3 of WebResource.axd. This is the first line of code in the files, and the line only has the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

How can i solve this? I don’t really like it.

In addition, I use RouteCollection and IRouteHandler. The site I used for guidance was http://www.4guysfromrolla.com/articles/051309-1.aspx . The only real changes that I made, I added 2 more links on my page that I did not create routes, but I never clicked on any of these links.

Since then, I have set 2 links, and the page worked fine for about an hour, and then again started throwing an error, and this time there seemed to be no rhymes or reasons for this. My biggest problem is that it makes no sense. The syntax error in the first line seems to be an odd error.

+4
source share
1 answer

After much research and research, I realized that! I just had to add this code to my RegisterRoutes.cs file:

 routes.Add(new Route("{resource}.axd/{*pathInfo}", new StopRoutingHandler())); 

I found the answer at http://msdn.microsoft.com/en-us/library/cc668201.aspx . This doesn't really explain it, but after some digging, I understand what my problem is. It replaced the code in my webresource.axd file, which is generated by IIS7, with my default NotFound.aspx page. Although the above code would seem to violate everything that it actually fixes, stopping the associated code from being overwritten

+6
source

Source: https://habr.com/ru/post/1301037/


All Articles