There is no need of DELETE verb. See
this when Delete verb is used.
The reason why you are seeing UnAuthorized error in IIS not in Cassini(local web server) is that you are not allowing your wild card map to allow Delete verb.
See
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
Marked as answer by ricka6 on Dec 15, 2010 04:00 PM
There is no need of DELETE verb. See
this when Delete verb is used.
The reason why you are seeing UnAuthorized error in IIS not in Cassini(local web server) is that you are not allowing your wild card map to allow Delete verb.
See
The solution you give here, is changing .svc to accept all verbs. I tried this with .mvc, didn't work.
I can't set this setting for a document without an extension, can I?
I also don't understand why you should not use the delete verb, is it because it can be overriden in each server?
If you put a "Hello world" asp.net web application, is the same?
This is good advice. Step 2 is to move a very simple MVC App (that has a delete method) to your IIS server. Cassini is a poor substitute for a reall IIS server. You have far too much complexity to start testing/debugging on a reall IIS server. I woud also
test this on IIS 7.5
I also don't understand why you should not use the delete verb, is it because it can be overriden in each server?
Just see the above w3.org link when should you need DELETE verb.
Quick solution is that just remove Delete verb.
Not recommeded solution is that, allow Delete verb in your wildcard map first and then then give rights to IIS user. The reason for these rights is that DELETE, PUT verb needed more rights.
(Just for sharing an example of using PUT verb which needs more rights
here)
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
Michielvv
Member
1 Points
9 Posts
Re: MVC2 delete action IIS6
Dec 15, 2010 02:14 PM|LINK
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "ListConfirmDeletes", "{controller}/ConfirmDelete/{parentID}/{*ids}", new { action = "ConfirmDelete" }, new { controller = new Drawing.Common.DrawingListControllerConstraint() } ); routes.MapRoute( "ListDeletes", "{controller}/Delete/{parentID}/{*ids}", new { action = "Delete" }, new { controller = new Drawing.Common.DrawingListControllerConstraint() } ); routes.MapRoute( "ListAdd", "{controller}/Add/{parentID}/{*values}", new { action = "Add" }, new { controller = new Drawing.Common.DrawingListControllerConstraint() } ); routes.MapRoute( "CreateDrawing", "Drawing/Create/{drawingNumber}/{sheetNumber}", new { controller = "Drawing", action = "Create" } ); routes.MapRoute( "AddSheet", "Drawing/AddSheet/{drawingID}/{sheetNumber}", new { controller = "Drawing", action = "AddSheet" } ); routes.MapRoute( "CopySheet", "Drawing/CopySheet/{drawingID}/{sheetNumber}", new { controller = "Drawing", action = "CopySheet" } ); routes.MapRoute( "TransmittalRemoveFromSelection", "{controller}/{action}/{id}/{project}/{page}/{transmittalID}", new { controller = "Transmittal", action = "Index" }, new { controller = new Drawing.Common.EqualConstraint("Transmittal", StringComparer.InvariantCultureIgnoreCase), action = new Drawing.Common.EqualConstraint("RemoveFromSelection", StringComparer.InvariantCultureIgnoreCase) } ); routes.MapRoute( "TransmittalDrawingDefault", "TransmittalDrawing/{action}/{id}", new { controller = "TransmittalDrawing", action = "Index" }, new { action = new Drawing.Common.NotEqualConstraint("Index", StringComparer.InvariantCultureIgnoreCase) } ); routes.MapRoute( "TransmittalDrawingIndex", "TransmittalDrawing/{action}/{transmittelID}/{page}/{sort}", new { controller = "TransmittalDrawing", action = "Index", page = UrlParameter.Optional, sort = UrlParameter.Optional }, new { action = new Drawing.Common.EqualConstraint("Index", StringComparer.InvariantCultureIgnoreCase) } ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults );<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;" id="_mcePaste"> routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"ListConfirmDeletes",
"{controller}/ConfirmDelete/{parentID}/{*ids}",
new { action = "ConfirmDelete" },
new { controller = new Drawing.Common.DrawingListControllerConstraint() }
);
routes.MapRoute(
"ListDeletes",
"{controller}/Delete/{parentID}/{*ids}",
new { action = "Delete" },
new { controller = new Drawing.Common.DrawingListControllerConstraint() }
);
routes.MapRoute(
"ListAdd",
"{controller}/Add/{parentID}/{*values}",
new { action = "Add" },
new { controller = new Drawing.Common.DrawingListControllerConstraint() }
);
routes.MapRoute(
"CreateDrawing",
"Drawing/Create/{drawingNumber}/{sheetNumber}",
new { controller = "Drawing", action = "Create" }
);
routes.MapRoute(
"AddSheet",
"Drawing/AddSheet/{drawingID}/{sheetNumber}",
new { controller = "Drawing", action = "AddSheet" }
);
routes.MapRoute(
"CopySheet",
"Drawing/CopySheet/{drawingID}/{sheetNumber}",
new { controller = "Drawing", action = "CopySheet" }
);
routes.MapRoute(
"TransmittalRemoveFromSelection",
"{controller}/{action}/{id}/{project}/{page}/{transmittalID}",
new { controller = "Transmittal", action = "Index" },
new {
controller = new Drawing.Common.EqualConstraint("Transmittal", StringComparer.InvariantCultureIgnoreCase),
action = new Drawing.Common.EqualConstraint("RemoveFromSelection", StringComparer.InvariantCultureIgnoreCase)
}
);
routes.MapRoute(
"TransmittalDrawingDefault",
"TransmittalDrawing/{action}/{id}",
new { controller = "TransmittalDrawing", action = "Index" },
new { action = new Drawing.Common.NotEqualConstraint("Index", StringComparer.InvariantCultureIgnoreCase) }
);
routes.MapRoute(
"TransmittalDrawingIndex",
"TransmittalDrawing/{action}/{transmittelID}/{page}/{sort}",
new { controller = "TransmittalDrawing", action = "Index", page = UrlParameter.Optional, sort = UrlParameter.Optional },
new { action = new Drawing.Common.EqualConstraint("Index", StringComparer.InvariantCultureIgnoreCase) }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Paramete
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "ListConfirmDeletes", "{controller}/ConfirmDelete/{parentID}/{*ids}", new { action = "ConfirmDelete" }, new { controller = new Drawing.Common.DrawingListControllerConstraint() } ); routes.MapRoute( "ListDeletes", "{controller}/Delete/{parentID}/{*ids}", new { action = "Delete" }, new { controller = new Drawing.Common.DrawingListControllerConstraint() } ); routes.MapRoute( "ListAdd", "{controller}/Add/{parentID}/{*values}", new { action = "Add" }, new { controller = new Drawing.Common.DrawingListControllerConstraint() } ); routes.MapRoute( "CreateDrawing", "Drawing/Create/{drawingNumber}/{sheetNumber}", new { controller = "Drawing", action = "Create" } ); routes.MapRoute( "AddSheet", "Drawing/AddSheet/{drawingID}/{sheetNumber}", new { controller = "Drawing", action = "AddSheet" } ); routes.MapRoute( "CopySheet", "Drawing/CopySheet/{drawingID}/{sheetNumber}", new { controller = "Drawing", action = "CopySheet" } ); routes.MapRoute( "TransmittalRemoveFromSelection", "{controller}/{action}/{id}/{project}/{page}/{transmittalID}", new { controller = "Transmittal", action = "Index" }, new { controller = new Drawing.Common.EqualConstraint("Transmittal", StringComparer.InvariantCultureIgnoreCase), action = new Drawing.Common.EqualConstraint("RemoveFromSelection", StringComparer.InvariantCultureIgnoreCase) } ); routes.MapRoute( "TransmittalDrawingDefault", "TransmittalDrawing/{action}/{id}", new { controller = "TransmittalDrawing", action = "Index" }, new { action = new Drawing.Common.NotEqualConstraint("Index", StringComparer.InvariantCultureIgnoreCase) } ); routes.MapRoute( "TransmittalDrawingIndex", "TransmittalDrawing/{action}/{transmittelID}/{page}/{sort}", new { controller = "TransmittalDrawing", action = "Index", page = UrlParameter.Optional, sort = UrlParameter.Optional }, new { action = new Drawing.Common.EqualConstraint("Index", StringComparer.InvariantCultureIgnoreCase) } ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults );r defaults
);</div>
sachingusain
Star
8786 Points
1702 Posts
Re: MVC2 delete action IIS6
Dec 15, 2010 02:42 PM|LINK
Okay, the simplest way ASP.NET MVC can be deployed is to tweak your routing information like this:
routes.MapRoute( "Default", "{controller}.aspx/{action}/{id}", new { controller = "Home", action = "Index", id = "" } );Note the ".aspx" extension after the controller.
And you would invoke it like:
http://servername/Home.aspx/Index/1
Try modifying your routing information and the delete URL and see if it works.
Thanks.
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: MVC2 delete action IIS6
Dec 15, 2010 03:27 PM|LINK
There is no need of DELETE verb. See this when Delete verb is used.
The reason why you are seeing UnAuthorized error in IIS not in Cassini(local web server) is that you are not allowing your wild card map to allow Delete verb. See
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
Michielvv
Member
1 Points
9 Posts
Re: MVC2 delete action IIS6
Dec 15, 2010 03:35 PM|LINK
What is this different then trying out with the .mvc extension?
Currently I'm not at the office anymore, so I can't test it right now
Michielvv
Member
1 Points
9 Posts
Re: MVC2 delete action IIS6
Dec 15, 2010 03:38 PM|LINK
The solution you give here, is changing .svc to accept all verbs. I tried this with .mvc, didn't work.
I can't set this setting for a document without an extension, can I?
I also don't understand why you should not use the delete verb, is it because it can be overriden in each server?
sachingusain
Star
8786 Points
1702 Posts
Re: MVC2 delete action IIS6
Dec 15, 2010 03:43 PM|LINK
You dont have to do any mapping in IIS that you would have done for .mvc
Thanks.
sachingusain
Star
8786 Points
1702 Posts
Re: MVC2 delete action IIS6
Dec 15, 2010 03:46 PM|LINK
I think @imran_ku07 might be correct you have to set that to either GET or POST.
Try changing it to GET or POST.
Also, I would recommend you that you use jQuery Ajax methods documented here. They are all browser agnostic and work like charm.
Thanks.
ricka6
All-Star
15070 Points
2272 Posts
Microsoft
Moderator
Re: MVC2 delete action IIS6
Dec 15, 2010 04:04 PM|LINK
This is good advice. Step 2 is to move a very simple MVC App (that has a delete method) to your IIS server. Cassini is a poor substitute for a reall IIS server. You have far too much complexity to start testing/debugging on a reall IIS server. I woud also test this on IIS 7.5
Why are you targeting IIS 6?
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: MVC2 delete action IIS6
Dec 15, 2010 04:26 PM|LINK
Just see the above w3.org link when should you need DELETE verb.
Quick solution is that just remove Delete verb.
Not recommeded solution is that, allow Delete verb in your wildcard map first and then then give rights to IIS user. The reason for these rights is that DELETE, PUT verb needed more rights.
(Just for sharing an example of using PUT verb which needs more rights here)
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: MVC2 delete action IIS6
Dec 15, 2010 04:33 PM|LINK
duplicate
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD