May 29, 2006

Enabling DTC between xp service pack 2 and windows server 2003

I spent two hours on enabling some distributed transaction between my iis server and windows 2003 server running sql server 2005. Thanks to people on the net , I compiled the following links.

For enabling DTC:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=230390&SiteID=1
http://blogs.msdn.com/florinlazar/archive/2004/06/18/159127.aspx

Followed the instructions both on IIS server and Sql server boxes.

Dont forget to enable both firewalls for msdtc and sqlserver!

here is what they say:
First verify the "Distribute Transaction Coordinator" Service isrunning on both database server computer and client computers
1. Go to "Administrative Tools > Services"
2. Turn on the "Distribute Transaction Coordinator" Service if it is not runningIf it is running and client application is not on the same computer asthe database server, on the computer running database server1. Go to "Administrative Tools > Component Services"
3. On the left navigation tree, go to "Component Services > Computers> My Computer" (you may need to double click and wait as some nodesneed time to expand)
4. Right click on "My Computer", select "Properties"
5. Select "MSDTC" tab
6. Click "Security Configuration"
7. Make sure you check "Network DTC Access", "Allow Remote Client","Allow Inbound/Outbound", "Enable TIP" (Some option may not benecessary, have a try to get your configuration)
8. The service will restart
9. BUT YOU MAY NEED TO REBOOT YOUR SERVER IF IT STILL DOESN'T WORK(This is the thing drove me crazy before)On your client computer use the same above procedure to open the"Security Configuration" setting, make sure you check "Network DTCAccess", "Allow Inbound/Outbound" option, restart service and computerif necessary.On you SQL server service manager, click "Service" dropdown, select"Distribute Transaction Coordinator", it should be also running onyour server computer.

On client and server:
netsh firewall set allowedprogram %windir%\system32\msdtc.exe MSDTC enable

May 28, 2006

CMS Logbook 5 - Setting default role for anonymous users (part 2)

First of all, this is valid for asp.net only.
Here's the situation, I have some business logic that needs authorization. Yet the not logged in users should have some access defined with the role 'anonusers'. The problem is how the business logic (a seperate class library) gets the authentication info. As this is a web site with Forms Authentication I used HttpContext.Current field to get the authenticated user.

The business logic , uses a base class property namely CurrentUser to get the current user authenticated:


public IPrincipal CurrentUser
{
get
{
if (HttpContext.Current !=
null)
return HttpContext.Current.User;
else
{
GenericIdentity
defaultIdentity = new GenericIdentity("anonymous");
string[] roles = new
string[1];
roles[0] = "anonusers";
GenericPrincipal genericPrincipal
=
new GenericPrincipal(defaultIdentity, roles);
return
genericPrincipal;
}
}
}

As you see if there is no user found in the context, this returns a 'anonymous' principal.

By this way I can now unit test all the business logic.

Ankara'da Seracilik


Finike ve Antalya'nin seraciliktaki basarisini takiben ben de neden Ankara'da da seracilik yapmayalim dedim. Degerli belediye baskanimiz Melih Gokcek 'in Ankara'da gol ve musluk sayisini arttirmadaki azmi de bana ayrica bir guc verdi. Ben de ilk seracilik projemi balkonda gerceklestirdim.
Gerekli malzemeler:
Kalin tel
Mutfaklarda yiyecek sarmak icin kullandigimiz seffaf poset

Yapilis:
Teli bukerek bir sekil olusturun , icine saksiyi alabilecek kadar buyuk olsun, daha sonra seffaf ambalajla kaplayin .

Bakalim icerdeki cin biberi bu giysiyi nasil karsilayacak?