1

My situation is similar to Q 1851155:
The HTTP verb POST used to access path '/' is not allowed
(but that was with IIS 7; I am using VS 2008's built-in web server. If that is IIS 6 or 7 beneath the hood, I don't know how to get at it to configure it.)

My situation is likely similar to Q 758780:
The HTTP verb POST used to access path '/Membership/user/' is not allowed
(Which suggests a link re configuration. But again, I don't know how that relates to VS 2008's built-in web server, rather than an explicit IIS 6 or 7 configuration.)

My situation is not at all like Q 5238080:
The HTTP verb POST used to access path is not allowed
(I am explicitly using POST; that question relates to an indirect use via LinkButton, and does not appear to be this path issue.)

problematic code snippet from an .aspx page, in a web site with Virtual Path "/":

    <form id="login" method="post" action="/login/">
    ...
    </form>

Resulting error page:

    Server Error in '/' Application.
    The HTTP verb POST used to access path '/login/' is not allowed.
    ...

This is on an up-to-date Windows 7 64-bit, with Visual Studio 2008 SP (Version 9.0.30729.1 SP), when debugging, using VS' built-in Web Server.

This case gives the error:
* When "Start Debugging" from VS 2008, using path "/login/".
That folder contains the single file "Default.aspx".

The following two cases work correctly:
* When "Start WITHOUT Debugging" from VS 2008, using path "/login/".
* When "Start Debugging", using path "/login/Default.aspx".

Therefore, I am having a problem when I specify the folder, and require the web server to infer the reference is to that folder's Default.aspx page. However, the problem ONLY occurs when DEBUGGING under VS 2008. (Launching from VS 2008 application, with my asp.net website solution loaded.)

QUESTIONS:
* Is VS 2008's built-in Web Server actually IIS 6 or 7? If so, how do I configure it?
* If not, Is there a way to tell VS 2008's built-in Web Server to work correctly when specifying a folder, rather than a file?
* If not, is there an alternate solution that can be downloaded (I did not renew my developer license, so I cannot download Microsoft subscription stuff at this time).
* Would renewing my license, and upgrading to VS 2010 help? If so, what specifically will I need to do to get that solution to work?

Community
  • 1
  • 1
ToolmakerSteve
  • 18,547
  • 14
  • 94
  • 196
  • Your action in the form is pointing to a directory, not to a page. Shouldn't it be something like `action=/login.aspx`? – Icarus Aug 24 '12 at 22:32
  • @Icarus see my response to jebar8. As stated in question, works when not debugging. Therefore the server's redirect from folder to default web page is valid. However, the most expedient solution is indeed to modify the path to specify the page. (Debugging an existing site that relies on this, such URLs could be scattered throughout pages and even code behind.) – ToolmakerSteve Aug 25 '12 at 21:40
  • @ShahroozJefriㇱ Why not? Please explain. – ToolmakerSteve Jul 11 '13 at 06:00
  • (my question to Shahrooz is in response to his comment that he gave question -1, because "it is not a good question". In response, he seems to have deleted that comment. But left the downvote in place. Odd, but oh well.) – ToolmakerSteve Jul 11 '13 at 08:01

2 Answers2

1

VS 2008's built-in web server isn't IIS, it is something called Cassini. It most certainly behaves differently -- it was wonky enough we ceased using it entirely, or at least would confirm any HTTP error on another platform before considering it a bug. Differences were great enough that Microsoft created IIS Express to help improve the local development story. You should upgrade to that and see if that fixes the issue before wasting any time dealing with HTTP issues on Cassini.

Wyatt Barnett
  • 15,573
  • 3
  • 34
  • 53
  • Thx, now attempting to use IIS Express. Successfully configured it to browse website without debugging (launching server in command prompt specifying /path:"D:\MyWebApp\"). Then shows as URL "http://localhost:8080/ ". However I haven't been successful at DEBUGGING from Visual Studio -- not stopping at breakpoint in code behind. Have followed instructions in http://stackoverflow.com/questions/4682727/how-to-configure-visual-studio-2008-to-use-iis-express -- starting iisexpress as an External program -- But Command window just comes up briefly, then closes. – ToolmakerSteve Aug 25 '12 at 19:54
  • If I start iisexpress manually via separate command window, I can get VisStudio to open correct page as "Start URL: http://localhost:8080/ " -- but still no breakpoints. – ToolmakerSteve Aug 25 '12 at 19:55
  • Marking this as answer; the details of hooking up IIS Express to VS 2008 are beyond scope of my original question. Summary: * VS 2008's default web browser isn't IIS, and is known to have issues; * There is an IIS Express that can be downloaded. * Upgrade to VS 2010 is alternate solution as it includes better web server (right??) (I expect to move up to VS 2010; If for some reason I come back to VS 2008 with IIS Express, and don't locate a question that addresses my failure to setup correctly for debugging, then I will post a new question.) – ToolmakerSteve Aug 25 '12 at 21:24
  • Or I should say that VS 2010 better integrates IIS Express, so don't have to mess around at the level necessary in VS 2008. http://msdn.microsoft.com/en-us/library/ms178108(v=vs.100).aspx How to: Specify the Web Server for Web Projects in Visual Studio -- Given VS 2010 SP1 "6.To choose IIS Express, under Servers, select Local IIS Web server, and then select Use IIS Express" – ToolmakerSteve Aug 25 '12 at 21:34
  • Transferred project to a PC that has VS 2010. Downloaded and installed IIS Express. Converted solution to VS 2010. Was not able to follow the "How to specify web server" instructions, perhaps recreating a new website project would have helped. Instead, found "Use IIS Server..." in rt-click menu of website in Solution pane. This added a new entry under "sites" section of My Documents/IISExpress/config/applicationhost.config. Also made some change (to solution file?) to make IIS Express the default web server. – ToolmakerSteve Aug 25 '12 at 22:24
  • Using VS 2010 and IIS Express, confirmed that "/login/" (as path of HTML POST) DOES activate (remap to) "/login/Default.aspx" page. Success! (FYI, VS 2010's built-in web server had the same glitch as VS 2008, so using IIS Express is essential, for this to work, during debugging. Is weird that "Start without Debugging" handled this even with built-in server, in both VS 2008 and VS 2010...) – ToolmakerSteve Aug 25 '12 at 22:33
  • Yup, cassini is really a waste for troubleshooting stuff. I used to jump through lots of hoops and develop against full-blown IIS, but IIS express makes this much easier as you are learning. – Wyatt Barnett Aug 26 '12 at 16:59
0

As far as I know you can only post directly to a page. There is no way to post to just a directory. The web server is not smart enough to know that you meant to go to Index.aspx or Default.aspx. You must specify the full URL to the page.

Is there a reason why you don't want to use the full url?

jebar8
  • 2,113
  • 3
  • 21
  • 31
  • Thx, but as I stated in my question, web server successfully translates the folder path into the default page, when used in HTML Post, when NOT DEBUGGING, demonstrating that the principle is sound, EXCEPT for some glitch in VS 2008's built-in web server, when launched for ASP.NET Debugging. (If necesssary I will of course use the full URL; I need to debug an existing website that a prior programmer developed, and need to minimize time put in to that task, while developing the replacement site.) – ToolmakerSteve Aug 25 '12 at 20:10
  • And you are right .. it finally sunk in that I was wasting more time trying to get this old setup to work, than simply modifying the offending URLs... (After this I will do new site under VS 2010, rather than mess with VS 2008 any more.) – ToolmakerSteve Aug 25 '12 at 20:31