ASP.NET News from Blogger:
mikes web log
Total News: 165
I'm just recording this for now, possibly for later investigation. In ASP.NET Web Pages 2 (Razor), you can take advantage of conditional attributes to set or clear attributes like selected and checked...
When you use membership security in ASP.NET Web Pages Razor, you can limit access to pages so that only logged-in users can see those pages. One way to do that, as explained before, is to add a test l...
In ASP.NET Web Pages/Razor, you use the @ character inside markup to mean "here be code." Like this:<p>@DateTime.Now</p>But suppose you want to display the @ character instead of use it ...
I was playing around with layout pages in ASP.NET Web Pages the other day and realized that there are actually two ways to pass data from the content page to the layout page: the Page object and the P...
Two tips for Razor syntax: using a conditional attribute to set the selected attribute in a list item; working around a syntax restriction on x@x (e.g. <h@level>).Tip 1When I wrote recently abou...
Just a note that we just posted a whitepaper [PDF] written by the super-smart Stefan Schakow that discusses various ways in which ASP.NET 4 lets you extend security. For example, the paper descri...
Ok, we've now got a list of the new features for ASP.NET Web Pages v2 posted. Here's a list of the stuff that's been added since the December 2011 preview, as recounted in the updated Top Features doc...
Another improvement in the Beta release of ASP.NET Web Pages v2 is better integration of the ~ operator. The ~ operator, as ASP.NET people know, resolves to the root path of the current website. (See ...
The beta release of ASP.NET Web Pages has been released (for example, as part of the ASP.NET MVC 4 Beta release). There are only a few differences from the December 2011 Developer Preview release...
As noted previously, to display validation errors in ASP.NET Web Pages v2, you can use Html.ValidationMessage and Html.ValidationSummary. You can use one or the other or both. If you use both, one ide...
In the last post, I laid out the basics of the Validation helper that's introduced in ASP.NET Web Pages v2. As I noted then, the helper supports both server- and client-side validation. Here's how to ...
In v1 of ASP.NET Web Pages, you could add user-input validation by doing something like this in code:if (name.IsEmpty()) { ModelState.AddError("Name", "You must enter a name....
We're quite happy to see a number of books about WebMatrix and ASP.NET Web Pages become available. Here is the list of books that I'm aware of at the moment:Beginning ASP.NET Web Pages with WebMatrixM...
On the forums, someone was asking about creating a horizontal menu using Razor code in ASP.NET Web Pages. The technique of combining an unordered list (<ul> element) with CSS to create a horizon...
A couple of us on the ASP.NET documentation team are working on a topic that describes how to disable request validation in ASP.NET. What do you think about the following draft? Any feedback welcome.R...
In ASP.NET Web Pages, you can use the FileUpload helper[1] to render HTML that lets user upload one or more files. For example, this helper:@FileUpload.GetHtml( initialNumberOfFiles: 1, allowMor...
If you use membership in ASP.NET Web Pages, you might get the error "To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider":I happened to run ...
The beta version of WebMatrix 2 was put out for public consumption around the time of the //build/ conference in September. Very nice.However, installing WebMatrix 2 beta makes it harder to ...
The canonical way to deploy a Web Pages application to a remote server is to use the Publish facility of WebMatrix. (Or the publish facilities in Visual Studio, if that's what you're using.) Using a p...
When I wrote about using simple membership in ASP.NET Web Pages a little while ago, commenter akshayms asked "How can I use Windows authentication"? Simple membership uses a login form and a members...
At first glance, you might thing that in WebMatrix Razor (.cshtml, .vbhtml files) you have to put all your code into the page. For example, if you sift through pages created by the Starter Site templ...
By default, ASP.NET performs request validation to prevent people from uploading HTML markup or script to your site. If someone includes markup in a page that they post to your site, ASP.NET throws a ...
The other day I showed how to send a confirmation email when people register on your site. In the example, I created a link that points to a confirmation page on my site, and I hard-coded the URL of t...
Most of what we write is published in the MSDN Library, which has documentation of all sorts for developers (the D in MSDN) who use the Microsoft platform. A recent estimate is that there are about 2....
When I described the most basic way to implement security (membership) for ASP.NET Web Pages/Razor websites, I skipped over a feature that you can add to the registration page — namely, confirma...
If you look at the ASP.NET Web Pages (aka Razor) tutorials on the ASP.NET web site, there's a chapter devoted to adding security to a site in the form of membership (that is, a login capability). This...
Most of the keystrokes you can use in WebMatrix are pretty familiar Ctrl+C/Ctrl+V to copy/paste, of course, plus Ctrl+F4 to close a tabbed doc, plus F3 for search. But there are a few that are not as...
The Beta 3 release of WebMatrix and ASP.NET Razor went out last Tuesday, and there are a couple of things in the release that are updates to something I've noted before. Setting Editor OptionsOne upda...
The ASP.NET Chart helper displays charts, as you can read in the chapter Displaying Data in a Chart:For purposes of the Chart helper, you specify the chart type (bar, line, area, etc.) by passing the ...
Here's a tip that came up on an internal alias today. When you create a database table in WebMatrix, you click the New Table button in the ribbon, define your fields, and then save. The save process g...
Suppose you want to concat together a bunch of strings and markup, maybe like this:var stringWithMarkup = "a" + "<br/>" + "b" + "<br/>" + "c" ;(Let's assume you're doing somethin...
I noted last time that we approached the documentation for WebMatrix and ASP.NET Web page (Razor) a bit differently. This was in part due to the target audience — Razor is aimed at folks who ar...
One of the design principles of WebMatrix and of ASP.NET Razor syntax is to keep things simple and friendly. Among the ways in which this is implemented in the UI, for example, is to focus on only the...
One of the more startling things that can happen when you first start to work with WebMatrix is that you'll be editing a page, click Run, and then see the error HTTP Error 403.14 - ForbiddenThe Web se...
Here's the first of a couple of tips that are gleaned from the WebMatrix/ASP.NET Razor Beta 2 readme file. But who reads the readme? :-)Tip: Helpers don't work in Beta 2 until you install them. Helper...
By now you'll probably know that we released (in beta) a new version, I guess you'd call it, of ASP.NET. It's not really a new version -- same old ASP.NET behind the scenes -- just a new and simpler s...
The other day I was doing something where I wanted to display some data as a comma-delimited list, like so:a, b, c, dThis seemed like a job for the Repeater control. So I created the markup for the co...
Visual Web Developer has long had a blank-sheet-of-paper issue when you create a new Web site project or Web application project in Visual Studio. As in, you create the project and then you, developer...
ASP.NET documemntation actually has a couple of homes. There's the grab-bag of articles, tutorials, and videos about ASP.NET that's posted on the http://asp.net site. And the official documentation --...
At work, we write documentation for programmers, so our docs include many code examples[1]. We should comment our code, right? Of course. However, a discussion broke out in our ranks yesterday about t...
An issue that has come up a number of times at work is the question of linking to articles in Wikipedia. It's not terribly unusual for us to link from the documentation set to non-Microsoft resources....
I've been in this industry a long time. This doesn't make me smart, just ... old. Being old, I find that my memory just isn't what it once was (which wasn't much). So for example ...A little while ago...
This is a question about the documentation on MSDN. There's a section on how to create custom ASP.NET controls, which starts at Developing Custom ASP.NET Server Controls:We're looking at maybe updatin...
As more people delve into ASP.NET MVC, we see more questions from people who are used to the Web Forms model and are curious where these technologies overlap. We have noted in the docs that views can ...
At PDC2008, Jeff King demonstrated features and improvements that his team is proposing for the next release Visual Web Developer. Among them are lots of tweaks to HTML editing. This got me thinking a...
As with so many things, it also started out so simple. I wanted to use UpdatePanel controls to throw a little AJAX-ification onto one of my blog management pages. (Specifically, the blog entry page.) ...
Apparently it's been too long since I've played with SQL Server databases. I say this because I made a boneheaded mistake today that obliged me to spend some quality time in the debugger. Someone aske...
Stack Overflow, the much-anticipated project put together by Jeff Atwood and Joel Spolsky, went live a couple of days ago. The site brings the known vectors for crowdsourcing to developer documentatio...
An ignominious appearance on the DailyWTF recently got one of our documentation topics some undue attention. Alas. The topic in question pertains to what around here we call an "internal only" type ...
I recently decided to implement a tag cloud. I'm not quite sure why this grabbed me; I don't pay that much attention to them my own self. But the idea of how to do it interested me, so I gave it a bas...
View Other bloggers