5/10/2008 19:17:37
Controller actions in an ASP.NET MVC application return an instance of a class
which derives from the ActionResult class, usually an instance of the ViewResult class.
Other classes which derive from the same base class are EmptyResult, RedirectResult,
RedirectToRouteResult, JsonResult and ContentResult.
We needed the ability to send a file to the browser and none of the existing classes
is well suited for that, so I created a custom ActionResult and called it FileActionResult.
13/12/2007 23:54:10
I was happily debugging my ASP.NET application in Visual Studio 2008,
when at some point I was presented with the following exception:
It is an error to use a section registered as allowDefinition='MachineToApplication'
beyond application level.
At first I had a WTF moment, but then I read the remainder of the message:
C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\WebSites\Gear\_darcs\pristine\web.config 49
While debugging locally my darcs repository directory is part of the web application
which is what causes the problem as it contains a copy of my web.config file.
So if you ever run into something similar, check your sub directories :-)
8/12/2007 0:18:57
The Mono team just released this version which comes with support for
ASP.NET 2.0 and ASP.NET AJAX. I've been using preview 2 for a while now
and it rocks, I'll try and update to the latest preview as soon as possible.
We're waiting for the final release of Mono 1.2.6 so we can deploy Blicbox 2.0.
You can download the files right here and report bugs here.
23/11/2007 14:40:36
I finally found the time to fix the OpenID authentication issue.
It prevented you from authenticating from the blog entry page.
Using
RequiredFieldValidators is a good idea... but not if you're
planning on adding AJAX functionality.
23/11/2007 14:37:10
Version 1.0.46 of the
System.Data.SQLite library is flawed.
After updating ObjectBlog from v1.0.43 I ended up getting
a series of Exceptions "Database is locked" for no apparent reason.
My code doesn't leave database connections laying around and closes
them as soon as possible every time. I'll see what the developers have to say.
Meanwhile, here's my advice to you. If you're using an older version
and it works... stick with it! (
At least for the time being).
20/11/2007 11:46:24
The current implementation of the GData API for .NET doesn't include full support
for Google Documents so for Blicbox 2.0 we'll need to implement our own code.
The ASP.NET application will have to authenticate with Google in order to
retreive a list of documents and fetch the content on subsequent requests.
For those who need an example, here's one way of authenticating:
private static string Authenticate()
{
HttpWebRequest authRequest =
(HttpWebRequest)HttpWebRequest.Create(
"https://www.google.com/accounts/ClientLogin");
authRequest.ContentType = "application/x-www-form-urlencoded";
authRequest.Method = "POST";
StringBuilder postBuilder = new StringBuilder();
postBuilder.AppendFormat("accountType={0}", GOOGLE_ACCOUNT_TYPE);
postBuilder.AppendFormat("&Email={0}", GOOGLE_USERNAME);
postBuilder.AppendFormat("&Passwd={0}", GOOGLE_PASSWORD);
postBuilder.AppendFormat("&service={0}", GOOGLE_SERVICE);
postBuilder.AppendFormat("&source={0}", GOOGLE_SOURCE);
byte[] data = ASCIIEncoding.ASCII.GetBytes(postBuilder.ToString());
authRequest.ContentLength = data.Length;
Stream requestStream = authRequest.GetRequestStream();
requestStream.Write(data, 0, data.Length);
requestStream.Close();
HttpWebResponse authResponse =
(HttpWebResponse)authRequest.GetResponse();
Stream responseStream = authResponse.GetResponseStream();
StreamReader responseReader = new StreamReader(responseStream);
string response = responseReader.ReadToEnd();
responseReader.Close();
responseStream.Close();
if (response.Contains("Auth"))
{
int index = response.LastIndexOf("=") + 1;
string auth =
response.Substring(index, response.Length - index);
return auth;
}
else
{
return "";
}
}
On subsequent requests, you simply add a header based on the result:
HttpWebRequest documentRequest =
(HttpWebRequest)HttpWebRequest.Create("...");
documentRequest.Method = "GET";
documentRequest.Headers
.Add("Authorization: GoogleLogin auth=" + auth);
Works perfectly on Linux + Apache + Mono :-)
19/11/2007 13:31:21
I'm looking into the possibility of hosting real ASP.NET applications
on our Linux servers instead of the Windows server.
Mono 1.2.6 comes with support for the ASP.NET AJAX.NET toolkit
and supports most ASP.NET 2.0 features.
I made a copy of my blog and dropped it on the Linux server.
To get it up and running I had modify the data access layer to use
Mono.Data.sqlite instead of System.Data.SQLite. Both libraries
are based on the same sources, but contain OS specific methods.
A quick way of doing that:
sed -e 's/System.Data.SQLite/Mono.Data.Sqlite/g' -i App_Code/*
sed -e 's/SQLite/Sqlite/g' -i App_Code/*
I also replaced the reference in my
Web.config file.
A few seconds later I had my blog up and running on Apache.
Most things worked out of the box after this change, with some exceptions.
I should be able to fix most of them, but this one got my attention:
20/08/2007 15:51:36
With
Dave Ward's help I've been able to add some nifty AJAX features to
the ObjectBlog
gallery. I was able to use his
HighSlide JS.NET control before,
but I was unable to get it working with ObjectBlog. I'm using a master page for
the site and
HighSlide JS.NET requires the
runat attribute of the
head element to
be set to
true when using a master page.
Dave has informed me that he will fix this issue in the next release.
16/07/2007 23:20:12
I just added support for
Name,
E-Mail and
Blogpage fields to the anonymous comments.
This information is stored along with the comments in the database which makes it easy
to retrieve for proper display in the list of comments.
Retrieving that information for authenticated users is somewhat more complicated.
User details of authenticated users are stored in a profile table so I can't just access it.
I'm not quite sure how I'm going to solve this, a few possibilities:
- Lazy loading: Load the information through a GetAuthorProfile() method of the Comment class. This would be a really straight forward way of getting the data, but slower.
- Dynamically load the Name, E-Mail and Blogpage information while retrieving the comments.
While this is faster, it doesn't really feel right... unless I rename some properties...
I still need to create links to the comment author's blogpage, but I won't do that untill I can
do that for Anonymous and Authenticated users alike.
11/07/2007 13:42:57
It's now possible to submit comments even if you don't have an
OpenID.
Anonymous users will not get access to the extra features provided by ObjectBlog,
and they'll have to submit their name and e-mail address every single time.
(
At the moment all comments made by visitors without an OpenID are anonymous)Before anonymous users can submit anything, they'll have to solve a
ReCaptcha.
I wrote a server side
ReCaptcha control for ASP.NET which does all the heavy lifting.
Using it is quite simple. You put the following code somewhere in an ASP.NET page:
<arendee:ReCaptchaControl ID="ReCaptchaControl1"
runat="server"
PublicKey="yourpublickey"
PrivateKey="yourprivatekey"/>
And then you check the
Validated property of the control before accepting any data.
I'll publish the code (along with everything else still need to publish) as soon as possible.
Update: There's an effort to create a control like this already in progress,
I'll see if I can help out there instead, since that's what I've been asked to do.