Thursday, September 29, 2005

Browser Caps for ASP.Net websites

Recently, the client I work for, ACH Direct, went on a Firefox compatibility drive. Though Firefox is used by only 7% of the market, as against IE's 93% in US, it is gaining popularity in Europe and Asia with usage hitting close to 40% of the market. With our clients insiting that our application needs to support FireFox and Mac OS we had to start working on it. The first time I looked at the website in Firefox, some of the pages really shocked me. The layout was badly messed up, and the table borders made the site look ugly. I immediately searched the Internet for the problem and I found something interesting.
ASP.Net applications use a lot of attributes defined in the web.config file. If those attributes are not defined in the web.config file, then the application picks it from the machine.config file in the Windows root directory. When the VS.Net 2003 version came out, Microsoft added Mozilla and a lot of other non IE browsers as down-level browser,which means the way ASP.Net server controls, panels, and div tags render themselves in the browser is different for IE and Firefox(HTML 4 rendered as HTML 3). To fix the problem, one needs to constantly update the browser capabailities section in the web.config file. If you want the change to show up in all the applications sitting on the IIS web server, the machine.config file needs to be updated(Always keep a backup just in case something gets really screwed up).

MSDN Resource

Keep an eye on this site for the latest browser caps update
Rob Eberhardt

Friday, June 24, 2005

Grant Execute Permission on SPs

declare @rows intdeclare @inx int

declare @tempProcs TABLE (rowID int NOT NULL, rowName varchar(250) NOT NULL) declare @tempProcName varchar(250)declare @query varchar(250)

Set @rows = (select count(*) from sysobjects where xtype = 'P' and name not like 'SP_%' and name not like 'dt_%')

insert into @tempProcsselect counter = 0, name from sysobjects where xtype = 'P' and name not like 'SP_%' and name not like 'dt_%'

--select * from @tempProcs
DECLARE @counter int

SET @counter = UPDATE @tempProcsSET @counter = rowID = @counter + 1

--select * from @tempProcs
Set @inx = (select Top 1 rowID from @tempProcs)
While (@inx <= @rows)

Begin

Set @tempProcName = (SELECT Top 1 rowName FROM @tempProcs where rowID >= @inx)-

-print @tempProcName

Set @inx = @inx + 1

Set @query = 'GRANT EXECUTE ON [dbo].['+@tempProcName+'] TO [userName]'-

-print @query

exec(@query)

--GRANT EXECUTE ON [dbo].[@tempProcName] TO [userName]

End

Monday, May 23, 2005

Capturing Page Refresh

Hello Geeks,
Today, I have a very interesting article to share with you. Often asp.net pages involve postbacks to the server to insert data, or update data. If you have ever put a breakpoint on your insert or update event and debugged your code, you must have observed something wierd. The page calls the last postback event, on refreshing. So if it is an insert or an update event , it is re-executed. To avoid this, we need to differentiate a page refresh from a page postback event. I have come across two great articles that help you achieve this feat Although one of them is based on the other, it gives you two different perspectives of solving the same problem. Please visit the below links for more information.
Dino Esposito's article
Steven Bey's article

Hope this helps you.

Wednesday, May 18, 2005

Hello World

Hello Guys,
This is the day I put my programming ideas, as part of a blogging habit. I start off with a small C# Hello World program which would give this blog a kick off.

using System
using System.Data


namespace ProgrammingCommunity
{

public class HelloWorld()
{

protected HelloWorld()
{

// I know that this program sucks,
// but hey this is my first one on the blog;
// So, just take it for now

}

}

}