You have to call like this "http://localhost:51192/UserProfileSurface/TestAction".
When you want to call Action method from Ajax then you have to call with "/umbraco/Surface/UserProfileSurface/TestAction"
I think this is because you marked your action with the [HttpPost] attribute. This means it's only available for POST request. When you try to access it through your browser that is a GET request. Try to remove the [HttpPost] attribute or replace it with the [HttpGet] attribute.
Surface Controllers and routing, 404
I have this code for the sruface controller:
I'm trying to access this through the url http://localhost:51192/umbraco/Surface/UserProfileSurface/TestAction But get returned with a 404 page. Shouldn't it be possible to access the surface controller this way?
Hi Thomas,
You have to call like this "http://localhost:51192/UserProfileSurface/TestAction". When you want to call Action method from Ajax then you have to call with "/umbraco/Surface/UserProfileSurface/TestAction"
Hi Thomas,
I think this is because you marked your action with the
[HttpPost]
attribute. This means it's only available for POST request. When you try to access it through your browser that is a GET request. Try to remove the[HttpPost]
attribute or replace it with the[HttpGet]
attribute.Dave
Thank you suman and Dave for your reply.
Dave, you where right, I overlooked that part about post vs get, and got the response I needed from directly calling it.
is working on a reply...