ASP.NET, AJAX, C#, Ruby on Rails, Web Technologies in general, and hopefully Agile Development.
Saturday, April 5, 2008
Every Build You Break
Tuesday, March 25, 2008
Visual Studio 2008 HotFix and VB HotFix
A HotFix for VS2088 was released early in February that addresses several issues reported with Web Applications. A list of the fixed bugs can be seen on ScottGu's Blog. You can download the hot fix here.
Also, 2 days ago, the Visual Basic team released a HotFix that solves some performance issues in VS2008. Download it here
Monday, March 24, 2008
App_Offline Goodness
It's as easy as uploading an App_Offline.htm file in the root of your Web Application directory and you are done. Include any "under construction" or "maintenance" messages in the App_Offline.htm file that you want to display to your end users.
Once you are done, simply delete the file and ASP.NET will reload the application and everything is back to normal. For detailed info check ScottGu's blog.
Friday, March 21, 2008
Server.HtmlEncode vs HttpUtility.HtmlEncode
Have you ever wonder why there is an Html Encoding function (and other similar functions) in 3 different objects and namespaces?
The most common one is Server.HtmlEncode or System.Web.HttpContext.Current.Server.HtmlEncode. The Server Object is an instance of the System.Web.HttpServerUtility Class and it is readily accessible through any .aspx page since they inherit from the Page object which in turn has a Server Object instance. The second HtmlEncode function lives under System.Web.HttpUtility. This class is basically a static version of the Server class which means that you could call the HtmlEncode function from a static function or call from another class that does not have an instance of the HttpServerUtility class. Finally, The third HtmlEncode function is located in the Microsoft's AntiCross-Site Scripting Library. In contrast with the Server.HtmlEncode and HttpUtility.HtmlEncode functions, the later function takes a more aggressive approach by using a white-list filtering instead of a black-list.
Hope this helps.
Wednesday, March 28, 2007
C# and VB together?
"The files '/WebSite/App_Code/VB/test.vb' and '/WebSite/App_Code/CS/test.cs' use a different language, which is not allowed since they need to be compiled together."
To go around this issue, simply add the following to your web.config file under the compilation tag:
<codeSubDirectories>
<add directoryName="CS">
<add directoryName="VB">
In this case, all the VB files and C# files were already separated into different folders inside the App_Code Folder.
Hope this helps.
Tuesday, March 27, 2007
A look at security vulnerabilities in web software
Click Here if video doesn't start
Getting Serious
Thursday, August 10, 2006
FTP in .Net 2.0
ftpRequest.UseBinary = true;
So here is a basic skeleton of how to download a binary file from an FTP location:
//Create the Request Object
FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create("the FTP URI");
ftpRequest.Method = WebRequestMethods.Ftp.DownloadFile;
ftpRequest.UseBinary = true;
//Now we create a response object and ge the response stream
FtpWebResponse ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
Stream responseStream = ftpResponse.GetResponseStream();
//Create the destination File
FileStream DestFile = new FileStream("your file name here", FileMode.OpenOrCreate, FileAccess.ReadWrite);
//Reading the response stream and writing it to the destination file
try
{
byte[] myBuffer = new byte[2048];
int stream= 0;
do
{
stream= responseStream.Read(myBuffer , 0, myBuffer .Length);
DestFile.Write(myBuffer , 0, stream);
}
while (!(stream== 0));
}
catch (Exception ex)
{
//handle your exception here
finally
{
DestFile.Close();
}
If the method returns something, you could return the FtpCode:
return ftpResponse.StatusCode;
I Guess the file writing part could still be implemented using the BinaryReader and Writer objects, but this way worked out for me.
Wednesday, January 25, 2006
Ajax Revolution
For .Net developers, more details about Ajax.Net can be found in the msdn library.
Here is a good article "Very Dynamic Web Interfaces" explaining Ajax with code samples.
A lot of big companies are switching their applications into Ajax. Even Microsoft's new version of hotmail will be heavily based on Ajax and Yahoo's new beta mail already uses Ajax. Other nice applications using this technolgy are ThinkFree and Writely.