Thursday, March 29, 2007

Another ASP.NET Adaptive Rendering Tip

For the background to this adaptive rendering thread, you may want refer to this previous post.

It turns out that in .net 2.0, the base "Mozilla" rendering profile sets the cookies capability to false. Why would it do this? Well, specific mozilla-derived browser profiles turn the setting back on, so it's not like asp.net thinks Firefox won't support cookies. Here's a clue, in the comments at the top of the mozilla.browser config file, showing some sample user agent strings that would match:

<!-- sample UA "Go.Web/1.1 (UP.Browser/3.1-UPG1 UP.Link/3.2; Mozilla/1.0; RIM957; Elaine/1.0 )" -->
<!-- sample UA "Mozilla/1.0[en]; Go.Web/1.1 (compatible; MSIE 2.0; HandHttp 1.1; Palm)" -->

Some old school mobile browsers were the targets here. Unfortunately, if users come to your site on, say, a Samsung Blackjack or another new device running WM5 and PIE, they end up in the same bucket. You can sniff this out by logging Request.UserAgent, Request.Browser.Browser, and Request.Browser.Type. I highly recommend doing this at least on one "entry" page for any mobile site. You may also want to log the computed capability for an attribute your app needs, like cookies (Request.Browser.Cookies).

Even though asp.net will automagically try to do cookieless sessions, I want to force cookie-based authentication on my mobile site so that users don't have to sign in every time they visit (those extra key presses are brutal on a phone). I know that more or less every mobile browser out there can support cookies now, so I'm not too worried about this decision.

The fix? Similar to the others, we'll just override this one attribute in our supplement.browser file:

<browser refID="Mozilla">
<capabilities>
<capability name="cookies" value="true" />
</capabilities>
</browser>


Another free bonus is that with cookies, asp.net doesn't have to do the URL mangling that is involved in cookieless techniques. So your users get URLs that make more sense in their history and work properly as bookmarks!

3 comments:

Anonymous said...

sometimes you can go to earn the mabinogi gold for your own life and you can also get a lot of happiness in the game if you play the game well. you can brush the cheap mabinogi to upgrade and then you are very strong. You think that you want to play the game well and then you can get the mabinogi money for your own. you can go to buy mabinogi gold alone and you can give some for your friends; it can make you very happy I think. As long as you play the game you can get the mabinogi online gold as the rewards in this game.

I knew the Metin2 gold so I always try my best to earn them more and more to make myself strong. I have never played the game before, at the beginning I did not know what is so I went to kill the monsters with the Metin2 yang that I earned with myself in the game. I will duty bound to a friend to help brush the Cheap metin2 yang together with my friends. I spend a good relationship is then fly to tears. If my levels are very high, I can go to Buy metin2 gold more and more and I will not depend on my friends to help me to earn them. I get some Cheap metin2 gold as the gifts to encourage me.

Anonymous said...

aion chinaaion china gold,
aion cn goldaion chinese gold,
aion gold chinaaion gold chinese,
china aion goldchinese aion gold,
aion china kinaaion chinese kina,
aion kina chinachina aion kina,
aion china buybuy aion china,
aion chinese server goldaion cn server gold,
aion china server goldchina aion server gold,
chinese aion server goldaion chinese server gold,
aion cn server kinaaion china server kina,
china aion server kinachinese aion server kina

Anonymous said...

Your article is great. Thanks for information. I'ts very useful. You have very nice blog.

------------------------------------------
Free Poker Bonus No Deposit Required - Sign up Promotions.
Free Poker bankrolls - Regards