views:

71

answers:

2

Why is it not OK to do a HTTP.Post to the default page on ASP.NET I have a default.aspx file that i want to be accessed when an external utility do a post to the

http://{ip}/WebSiteName

I want that the actual post will be to this page:

http://{ip}/WebSiteName/Defualt.aspx

or

http://{ip}/WebSiteName/Handler.ashx

I think that if i get it to post to the first url, i will be able to recreate a new post to the second url - which is my original target.

Thanks, Itay

A: 

Check out this KB article: http://support.microsoft.com/kb/216493

HTTP Error 405 Method Not Allowed

The method specified in the Request Line is not allowed for the resource identified by the request. Please ensure that you have the proper MIME type set up for the resource you are requesting.

This problem occurs if the following conditions are true:

* You do not specify the file name. For example, you do not specify http://Server/Web/.
* The Scripting Object Model (SOM) is enabled.
* A DTC event is called.

It is a known bug in IIS 4 and 5 but corrected in 6.

David Neale
Are there any workarounds that can support this method on IIS 5.1?
Itay Levin
I have also tested it in IIS 6 and it is not working...maybe i missed something in here?
Itay Levin
Could it be a configuration issue, should i add to the web.config something like that : <add verb="POST" path="/App_Code/Handler.ashx" type="??"/> ? would that cause the POST to work?
Itay Levin
A: 

You could set your first page IIS looks for to be index.aspx, then on that page do a Response.Redirect("~/Default.aspx", true) and that should reproduce what you need.

TheGeekYouNeed
Response.Redirect is the problem. IIS is giving him a redirect and that's why the post is failing. Redirect tells the browser to issue a GET request.
matt-dot-net
Matt is right, i already using this feature of the IIS - to redirect to one of the default pages - and it is failing.Wait, Matt - what if i remove all the default pages...what will happen? if i have a site with only one page in it? whould he get the post?
Itay Levin
Could it be a configuration issue, should i add to the web.config something like that : <add verb="POST" path="/App_Code/Handler.ashx" type="??"/> ? would that cause the POST to work?
Itay Levin