Search This Blog

Friday, February 29, 2008

ASP.NET ATOM Feed auto-discovery

Adding a RSS feed auto-discovery code to your site is essentially a usability feature. It allows browsers capable of RSS auto discovery such as IE7, Firefox and Safari to display a nice RSS icon RSS.

Safari:



IE7:



Firefox:



How to do that?

add below code to your rss feed after <?xml version="1.0" ?>

<link rel="alternate" type="application/rss+xml" title="Top new 20 posts rated" href="http://www.xxxx.com/rss" />

or
for ATOM feed

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:xxxx="http://www.xxxx.com/">

where http://www.xxxx.com/rss is the feed url

Let me know if you need more info.

Thursday, February 28, 2008

Visual Studio 2005: publish website error - target folder empty

Do you have experience that after you have successfully published your application but the target folder is empty?

  1. Click "Publish Web Site", enter "Target Location", and click OK
  2. Site builds successfully
  3. files in destination directory are deleted
  4. IDE shows "publish succeeded"
  5. Go to check target directory, it's empty.

In my case, it caused by mispell an HTML tag. Fix the tag help to fix the published problems.

If this not work for you, try this alternative suggested by other developers.

Fix IIS mappings for ASP.NET, run the Aspnet_regiis.exe utility:

  1. Click Start, and then click Run.
  2. In the Open text box, type cmd, and then press ENTER.
  3. At the command prompt, type the following, and then press ENTER:
    "%windir%\Microsoft.NET\Framework\version\aspnet_regiis.exe" -i
    In this path, version represents the version number of the .NET Framework that installed on server. Must replace this placeholder with the actual version number when type the command.

Tuesday, February 26, 2008

UPDATE ... INNER JOIN

Example:

UPDATE sm
SET sm.SysConfId = sc.Id
FROM tblSKUMat sm
INNER JOIN tblSysConf sc
ON sm.Id = sc.Id

Monday, February 25, 2008

ASP.NET Cookies is domain dependent

Cookies is Domain dependent. Cookies created under subdomain beta.mydomain.com will not able to retrive when access to www.mydomain.com. To ensure that we can retrive the same cookies, we need to specify the domain
For example, we want to write the information to cookies under mydomain when we access to url beta.mydomain.com

HttpCookie cook = new HttpCookie("mydomain");
Response.Cookies.Clear();
Response.Cookies.Add(cook);
cook["UserId"] = userId;
cook["Name"] = username.Text;
cook.Expires = DateTime.MaxValue;
Response.Cookies.Add(cook);

To retrive the cookies information:

if (Request.Cookies["mydomain"] != null)
{
if (Request.Cookies["mydomain"]["UserId"] != null && Request.Cookies["mydomain"]["Name"] != null)
{
Session["UserId"] = Convert.ToInt32(Request.Cookies["mydomain"]["UserId"].ToString());
Session["UserName"] = Request.Cookies["mydomain"]["Name"].ToString();
}
}

Sunday, February 17, 2008

Get value from dynamic (number) radio button using vbscript

Here is my scenario, i have a ratio button but i'm not sure how many radio button will be populated. It can be one or it can be more than one (Array). I've tried many way to make it work but fail. Finally come out with below work around.

On Error Resume Next
radCount = document.all.RadDynamic.length
If err.number <> 0 then
If document.all.RadDynamic.checked Then
strLogoID = strLogoID & "," & document.all.RadDynamic.value
End If
Else
For i=0 To document.all.RadDynamic.length -1
If document.all.RadDynamic(i).checked Then
strLogoID = strLogoID & "," & document.all.RadDynamic(i).value
End if
Next
End If

Wednesday, February 6, 2008

Happy Chinese New Year


Happy Chinese New Year!
心想事成!

Friday, February 1, 2008

Firefox - Secure and Faster Web Browser



The award-winning Web browser is now faster, more secure, and fully customizable to your online life. With Firefox 2, added powerful new features that make online experience even better.


1. Enjoy a Better Web Experience
Firefox 2 delivers helpful new features to make online experience more productive.




2. Stay Secure on the Web
Firefox continues to lead the way in online security, and now includes active protection from online scams to keep safer.


3. Personalize Your Browser
Choose from over a thousand useful add-ons that enhance Firefox. It’s easy to personalize Firefox to make it your own.