Is the .ASPX extension ONLY associated with Web Forms? - asp.net

Dumb question (maybe) I have searched online but I'm looking for somewhat a yes no type of answer. If you ever see a website with just xxx.com/xxx.aspx ... was that application created using Web Forms? Is ASPX only associated with Web Forms?
Thanks

To answer your question in yes or no (as asked), NO.
You can do that in ASP.NET MVC as well, by setting up the routing in that fashion. But I don't think anybody would do that.
On another note, if you have come across a website which is xxx.com/xxx.aspx, you can make a decently good bet that it was developed in ASP.NET WebForms.
Hope that helps!!!

Technically no. The web server software determines how to handle every request. It could be configured pretty easily to say that any requests for a file with a .aspx extension should be handled by the PHP parser, or Ruby, or whatever. Or, if using ASP.NET MVC, you could set up routes that resources that end in .aspx are still handled as MVC pages.
Of course, there aren't many reasons that someone would WANT to do that. The only reason I can think to do so would be if you're explicitly trying to make people think that a page is using a different technology than it is. And I don't see that being a common goal.

Related

Is there a reason that cshtml isn't popular

Firstly, I have only recently tried my hand at building with razor in cshtml using Webmatrix and I found it much less time consuming than building aspx web forms. Having gotten used to it, I can now do all the things I used to do inside my aspx projects much quicker and with much less code...
Now, I've spent today looking around google etc at companies using cshtml, what they're using it for etc, but I can't find a large range of examples out there. Maybe I was just looking in the wrong place, rendering this question title incorrect, but I just had a feeling that there is a reason why companies are still using aspx over cshtml.
I'm about to start a project next month for a big client and I can't decide whether to take the step of building it this way (they need a custom blog, login area etc). Any thoughts? The only other stack thread I found of any use with regards to a debate was: Razor/CSHTML - Any Benefit over what we have?
Thanks,
Adam
A lot of it has to do with ASP (classic) has been around a lot longer and (depending the project size) a migration can incur too much cost.
There's also considerations like:
What does the current web staff know (what are they fluent in?)
What libraries (proprietary or otherwise) are already dependent on ASP (including custom controls).
How much of an SEO hit are you going to take converting (some sites can mimic classic aspx page suffixes by just changing the way the routes behaving but are in-fact using cshtml).
There isn't a compelling reason for experienced ASP.NET developers to move from Web Forms or MVC to Web Pages (Razor). As a framework, it is designed to attract those who might find Web Forms or MVC too much of a learning curve. Those coming from Classic ASP or PHP, for example.
I answer a lot of questions on the Web Pages framework over at the ASP.NET forums, and I have definitely seen an increase in the number of people trying the framework out. In terms of functionality and security, you have the whole ASP.NET framework behind you so you can do anything with Web Pages that you can do with MVC or Web Forms - a lot of it more easily.
The Web Pages framework is not designed with testability in mind, and it may be more difficult for teams to organise since a certain amount of server-logic is embedded in the same file as HTML.
If you are a lone developer and happy using Web Pages, go for it.
There been a lot of discussion about the topic. Its just opinions, right tool for the right job. Please look into the following for opinions & answers:
MVC 3 ASPX VS RAZOR View Engine
Razor vs Webforms view engine for new ASP.NET MVC 3 site
What is the difference between Razor and ASPX?
Hope this helps

Use Webmatrix Razor to Replace Classic ASP Site

I have been looking at ASP.Net Web Pages and I think it would be a good replacement for some classic asp sites I am working on. There is a lot about them that is similar to how classic asp did things, so I believe there is a chance I can drag the other programmers into the present. My problem is that I have yet been able to find any indepth documentation to see if there is any "gotchas" I need to be aware of if I choose to go down this path. So if anyone knows of any, I could really use that information. I think going straight to MVC and Web Forms would be a bridge too far for the others at the moment. Thanks.
Wade
I found a link from Mike Brind - should I use WebMatrix to build a real-world website?
I'd suggest that Web Pages as a framework is probably the best next step you can take, but I would also advise that at least one person in the team takes time to understand the basics behind the MVC pattern. You may decide it's too much for the majority of the team at the moment, and that's fair enough, but you can use your knowledge to plan the development of the Web Pages site so that it can be more easily converted to MVC at some stage in the future, should you decide that's the way to go.
The things I would look at (coming from a classic ASP background myself) are functions and helpers. Decide on a data access strategy - The Entity Framework works well with Web Pages and can be transferred to MVC easily. Avoid the Database helper. Use Visual Web Developer 2010 SP1 for the Intellisense option.
As Knox said, you have the whole of the ASP.NET framework available to you so there should be no Web Pages specific "gotchas", and it's a massive step up from classic ASP.
I've been using Webmatrix/WebPages/Razor for a while now and like it. It's been a while since I used Classic ASP, but WebPages to me feels like a true successor to classic asp and what ASP.net should have been from the start. I'm actually moving most of my smaller sites to the WebPages framework from WebForms. Here are some things I've encountered.
I'm not sure if this is a gotcha or not, but I thought I would mention that with WebPages the scope of your variables may behave differently. I know a lot of Classic ASP sites that used to use include files to run snippets of code. Many of them depended on global variables set in the parent document. In WebPages, if you use RenderPage or Helpers to replace includes they run mostly outside of the Parent's scope. If you used Server.Execute instead of includes then you might not notice much difference, but if you did use includes and lots of global variables you may notice it.
Another possible gotcha is in ClassicASP <%=%> doesn't encode output, but in WebPages the Razor syntax # encodes output by default.
Another thing to consider is using C# vs VB.net with Webpages. Although vb.net works you'll find that most samples, tutorials and people in forums use C#.
Finally something that bothers me is that it is named the "webpages" framework. I've found it hard to do a good Google search using the term "webpages". Even "asp.net webpages" brings back mostly webform results. I have more success using "webmatrix" or "razor".
Can't recommend any documentation but here is an introduction to Web Matrix on mikesdotnetting.com blog where he has blogged quite a lot about Web Pages with Web Matrix.
We have two production sites, developed using Web Matrix. One serves our customers, the other is an intranet for our staff. They've been running in production for almost a year. I'd say about 95% of the sites were developed purely in WebMatrix IDE with about 5% going into Visual Studio, especially for the occassional obscure debugging. We're happy with WebMatrix / Web Pages. I didn't use WebForms because I was concerned about WebForm's ability to do really lightweight pages, since many of our users are using cellular data on iPads or iPhones. I didn't use MVC because of the additional complexity, since many of our pages are just showing the user read-only data from our production database. Because WebMatrix gives you access to the complete ASP.NET library, I haven't felt held back at all.
We are currently converting our ASP pages to Web Matrix. We tried to do conversions using WebForms a few years ago, only ending in frustration. After a small learning curve on the C# and Razor syntax, our development staff feel that we made a correct decision in going with Web Matrix.

Integrating MVC code into asp.net forms site

I have an asp.net forms based site, and I am thinking of somehow integrating OpenForum which is written using MVC. I don't have any experience with MVC, so I'm wondering should I even bother - is it possible/makes sense to build this hybrid?
I guess you can add OpenForum like a SUBWEBSITE for the your MAINWEBSITE under IIS. It should work well because it is going to have its own BIN folder as well as web.config.
It's certainly possible. I've done it the other way around - added ASP.NET forms into an MVC site. And it may make sense (I've never used OpenForum), one could migrate to MVC this way.
If you search for "mix mvc and asp.net" there's a few resources with step by step instructions.
You can have some working side by side, but you mentioned in a comment about wanting to share master pages and user controls, and that's most likely going to be somewhere between difficult and impossible in some cases.
MVC doesn't use Viewstate which is a big part of webforms, nor does it have the concept of a postback. It's an entirely different paradigm. You can share session and also common classes and data structures, but as far as re-using view logic between them, it's most likely not going to be easy.

Moving from WebForms to ASP.NET MVC

i know ASP.NET and i would like to learn and make a new project in ASP.NET MVC.
Is it easy to move from asp.net to asp.net mvc? Will the knowledge i have so far be helpful?
Im asking because i will have only few days to learn asp.net mvc and i want to know whether it's possible...
Cheers
I think you will find this questions (and its answers) very helpful.
Is it easy to move from asp.net to
asp.net mvc?
My answer to this would be a question back to you. Do you understand HTTP? Is web forms sort of magical to you, or do you have a firm grasp of what the abstraction is doing?
The reason I ask is that MVC sort of strips away a lot of the "magic" that web forms gives you in terms of treating a stateless protocol as actually having state. I tend to think of out of the box web forms development closer to classic windows forms development then normal web development. There are good and bad things about that.
What MVC is doing is bringing closer to what is actually happening in HTTP and in the end giving you more control and power over that. What you won't find in MVC is slew of drag and drop datagrid type controls, but it will make it easier to write AJAX heavy sites with common javascript libraries and clean html, as well as enable you to more easily write testable code.
Will the knowledge i have so far be helpful?
Without knowing what your "knowledge" is, it is hard to say. Obviously c# and vb are the same it's not like its a new language.
It really comes down to what type of web developer you were in asp.net forms. If you found yourself annoyed at how IDs were generated and how the html output of controls was horrible and that the framework was making it hard to do what you want then you should be fine.
If you were like I stated before, more of a drag and drop type of web forms person than MVC might be a bit challenging, but I would say its a good challenge and something that will ultimately make you a better web developer.
The only way you'll really know is if you try... There are tons of resources out there to get you started.
Hope that helps. Don't be afraid to ask questions on here as you go, there are tons of MVC devs on this site.
If you've ever used technologies like ASP classic, Coldfusion, PHP, etc. where you intersperse regular markup with server-side logic, then you will be able to pick up the "view" syntax pretty easily. The controllers are pretty simple to grasp once you get the hang of it, and the model shouldn't have to change from what you are used to. The hardest part for me to grasp when first learning ASP.NET MVC was the routing.
Like anything else, it will take some effort before you learn the "right" ways to do certain things, and you will initially be a bit less productive in the new technology. But in the end it is worth it.
Personally, I felt that ASP.NET MVC was far easier to learn than ASP.NET WebForms.
Run through the NerdDinner tutorial. It should take you about half-a-day. I think you'll find the simplicity refreshing.

Convert existing asp.net application (large) to web standards

I have a very large ASP.NET project that i need to make good with web standards -- the application has two parts:
1.) An administrative piece that allows users to 'build' sites
2.) Front end that makes up the users sites (many web controls, master pages, usercontrols, etc... much of it is just code)
I was wondering what poeples recomendations are for making this project utilize web standards? Should i look more into MVC? I havent done anything with MVC but it seems to support friendly URL's by default.
Has anyone done this with an existing large ASP.NET application/site?
thanks in advance :-)
What do you mean by web standards? Valid html/css? no-tale layout? valid javascript?
I suggest you just test it in different browsers and fix the problems you find.
There are two routes you can take.
1) Rip it up and start again
2) Modify what you have and incrementally change it 'one page at a time'
I know that's a simple and obvious answer but truthfully, having done both, they are both viable.
A modern ASP.NET web applciation CAN be standards compliant, can have nice urls with some url re-writing and can seperate content from design. You just need to think before you act, make sure you use .NET 2.0 or .NET 3.5 controls and inspect the output to ensure you're getting good markup.
Converting an old web app to MVC can;'t really be answered without knowing the app itself. It might be perfectly suited to it and be easy, it might be a world of pain.
As always use the best tool for the job.

Resources