Pages

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.

Thursday, January 31, 2008

Compiler Error Message: CS0016: Could not write to output file 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\xxxxxx\xxxx

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0016: Could not write to output file 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\wholesales\xxxxx\xxxxx\App_Code.xxxxxxx.dll' -- 'Access is denied. '




After some antivirus activities, my partner development machine face issue above.

This may due to some permission setting in Temp folder. To solve it,

1. Go to %Systemroot%, normally C:\WINDOWS or C:\WINNT
2. Right-click the Temporary folder (mine is C:\WINDOWS\Temp) and select Sharing and Security. Select the Security tab and take a look at the list of “Group or user names:”
3. NETWORK SERVICE should be in the list. If it is not, click Add and type Network Service in the text box:

4. Make sure NETWORK SERVICE have Full Control in the Permissions list.

5. Click OK.

6. Restart IIS (Run iisreset)

Test on the web, and it solved.





If you still have the same problem, please check whether you are using McAfee antivirus. If yes, it's probably cause by the access protected properties setting in mcAfee antivirus. Please make sure you unchecked "Prevent execution of scripts from the Temps folder" in "Access Protection Properties"
To do so, right click on McAfee icon in Taskbar and Click on "VirusScan Console..."


Double click on "Access Protection" and a new "Access Protection Properties" window will pop out. Make sure you unchecked "Prevent execution of scripts from the Temps folder" under Block column. Click OK to close all the window.


Problem should be solved.

Friday, January 25, 2008

VBScript New Line

I do have some projects that written in Classic ASP. I come accross the case that need to draw NewLine in Classic ASP.

Response.Write (vbCrLf) solve my problem

Thursday, January 24, 2008

Create failed for Login 'xxx'. (Microsoft.SqlServer.Express.Smo)

I was trying to create a user with weak Login Name and password. Error message below shown.

Create failed for Login 'xxx'. (Microsoft.SqlServer.Express.Smo)
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)

The MUST_CHANGE option is not supported by this version of Microsoft Windows. (Microsoft SQL Server, Error: 15195)





What i do is uncheck the "Enforce password policy" when create the new user. This way you will not get the error message, but this is not the recommended way for the production Login Name and Password.





Problem solved.