views:

86

answers:

2

Okay I hear that thing all the time on internet when reading an article about MVC : "Since Asp.NET MVC is REST, it is easy to consume ... etc." I've never heard such a thing for Asp.NET Webforms and it makes me wonder what makes something REST.

As I understood, REST means Representational State Transfer in which what a user see on their browser is a state. But I don't think it means it always should be like RPC as MVC does. It could be a physical page served by the server like how it works in Asp.NET WebForms (Default.aspx) As long as it returns a state representation, it is called REST.

So if my understanding is fine, then shouldn't webforms be also REST?

Uggh, I am kinda confused....

Thanks in advance....

Edit and brief answer : Okay folks, listen up :) this is the answer I believe which is correct :

As we know it REST should match basic principles below :

* Give every “thing” an ID
* Link things together
* Use standard methods
* Resources with multiple representations
* Communicate statelessly

So as we know it, webforms use highly postbacks, session to get idea about the previous requests and you can do postback countless times to get something like :

search.aspx and post the selected value of a dropdownmenu and there is no get, only post and postback from the server.

Well it obviously cannot be restful architectural style.

A: 

It is surprising statement. If I use session in ASP.NET MVC it will not be REST at all.

Edit:

REST is stateless. If I use session the prcessing will become stateful. Subsequent requests will be able to use state (from session) so the HTTP response will not contain whole state.

Ladislav Mrnka
Can you elaborate your last statement?'If I use session in ASP.NET MVC it will not be REST at all.'
Braveyard
No REST at all for the wicked!
bzlm
A: 

The goal of URL routing in MVC is search engine optimization, and user-friendly URLs. It is not a REST protocol in any formal sense, as it doesn't use the HTTP verbs (other than the usual GET and POST), and is not designed for data. URLs correspond to controllers and actions, not to any data schema.

MVC will also give precedence to any URL that maps directly to a file, so WebForm-type routing is still possible.

WCF does support REST, but as a data transfer protocol, not a page-mapping mechanism.

You might want to read up on REST; it really is entirely separate from ASP.NET MVC routing.

Cylon Cat
There is a figure which shows the relationship between MVC and REST: http://ur.ly/kQPw and you can find whole article under this link : http://ur.ly/kYT9
Braveyard
ASP.NET MVC has first-class support for any of the HTTP verbs. Stop the FUD. :)
bzlm
OK, I stand corrected, but I don't believe that this was the original or primary intent in MVC. REST is a web service protocol; ASP.NET MVC is about site and page design and implementation. I'd much rather leave service design and implementation to communication tools such as WCF.
Cylon Cat
@Cylon REST is not a protocol. Nor is it a "web services protocol", whatever that means.
bzlm
@bzim, REST is a data access protocol implemented through HTTP. Call it whatever you want. (And, by the way, where are your manners?) REST has nothing to do with navigating a web site, which is what ASP.NET MVC's URL routing is all about. Even if a REST protocol can be implemented in ASP.NET MVC, calling ASP.NET MVC "restful" is inaccurate and confusing.
Cylon Cat