Tuesday, November 28, 2006

Dynamic image resizing and caching in ASP .NET

Recently I have faced a problem of caching in ASP .NET. What happened was, I was using an ASPX page to resize the image size by passing the required image width and image path in querystring. An example image resizing tag that I was using will look like this..


< i m g src="thumbnail.aspx?filename=" width="170" />

The above tag works perfectly when it was running on .NET framework 1.1 but when I changed my server to framework 2.0 all the images displayed are the same, no matter the image path and file name was changed!! I knew it was a problem with the caching feature in .NET 2.0. So I googled for a solution for this, and figured out this cool tag to control the caching based on the parameters passed to the ASPX page. Here’s the tag that you need to place at the top of the ASPX page.

< % @ OutputCache duration="1000" varybyparam="width; filename" %>

After implementing the above code the page rendered as expected, and the caching was controlled based on the width and file name passed in querystring. You can find more information about this and the serverside thumbnail script from here http://west-wind.com/weblog/posts/283.aspx

Monday, November 27, 2006

Saturday, November 18, 2006

Web portal of Ministry of Economic Development and Trade is on BETA run

Ministry of Economic Development and Trade's webportal of general services is out for beta testing. The website address is http://services.trademin.gov.mv/. From this site you will be able to search the registered business names in Maldives. This include shops, café's, companies etc. An interesting feature in this website will be the SMS functionality. You can reserve business names for a specified duration and will be notified via email or SMS when your reservation expires. Sounds interesting dho.. but the sad news is that SMS part is not yet functional in the website but I have completed it and given to the Ministry.

Thursday, November 16, 2006

Safariyyath Maldives website hosted tonight



I have uploaded the website of Safariyyath Maldives tonight. This was a redesigning project to make the site compatible with all the latest browsers in the market and to include multi-lingual functionality. But I haven't finished the english pages yet. Now the website is fully dynamic and is scripted using the ASP VBScript and ASP .NET. Here's the link for the website, so take a look and drop a comment.. thanks.. www.jazeera-maldives.com.mv

Wednesday, November 15, 2006

Nice cloud


This is a photo that i have taken from my phone while i was going for a ride in hulhumale' (the place where i live) What do you see from this...

Tuesday, November 14, 2006

How to send Arabic email using CDOSYS in classic ASP

I have been trying this for a couple of weeks now and last night i have found a way that it could be done quite easily in classic ASP. Sending emails using the SMTP server in windows is quite easy, however i have been trying to do this for a client where he needs to send emails from the website using arabic characters when users make reservations from the website. After completing this page using a typical ASP page, i figured out that the arabic characters are displayed as ????? (question marks)..

As usual, i tried to solve this problem by searching the google to find a solution for this. I found that many people have faced the same problem as me, but couldn't find a solution. Then i tried to search the Microsoft website to find the members of the "CDO.Message" object. And finally i figured out that there is a property to change the charset of the message body.. and when i changed this charset to "utf-8" it worked!!


Here's the source code of the ASP file, so that anyone who faces this problem might find this useful..


set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
cdoConfig.Fields.Update
set cdoMessage.Configuration = cdoConfig
cdoMessage.BodyPart.Charset = "utf-8"
cdoMessage.From = "from@mail.com"
cdoMessage.To = "recipients@mail.com"
cdoMessage.Subject = "Arabic Email usin SMTP - CDOSYS"
cdoMessage.HtmlBody = "مرحبا بك فى المالديف"
cdoMessage.Send
set cdoMessage = Nothing
set cdoConfig = Nothing