Wednesday, July 12, 2006

C# Blog

Checking permission to view a page

As we start to build the blog, we also need to know whether someone is authorized to view a page that requires administrative functions. This is going to come into play a little later when we create a simple section to add a blog entry.

Remember this is the .NET framework, so we are not going to have a lot of code to write. All we will need is the following:


if (Request.IsAuthenticated == false)
{
Response.Redirect("login.aspx");
}

This checks the that the request being made is authorized, if not send it back.



Creating a blog entry


So now we have a database a database for posts. This is not useful until we add two pieces of code to handle creating a blog entry and displaying a blog entry. Let's first quickly put together a page to handle adding a post.

We can quickly create a connection to the database for the blog by using a data source control. This is one of the key features of .NET we rapidly build what we need to build.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home