DSC_6164

DSC_6159

DSC_6158

DSC_6161

 

DSC_6165

DSC_6166

DSC_6170

DSC_6172

DSC_6174

DSC_6177

DSC_6173

DSC_6178

DSC_6193

DSC_6195

DSC_6242

DSC_6268

DSC_6276

DSC_6278

DSC_6282

DSC_6287

DSC_6292

DSC_6299

DSC_6300

DSC_6298

DSC_6479

DSC_6473

DSC_6470

DSC_6465

DSC_6463

DSC_6458

DSC_6452

DSC_6444

DSC_6440

DSC_6399

DSC_6400

DSC_6403

DSC_6405

DSC_6408

DSC_6423

DSC_6425

DSC_6431

DSC_6434

DSC_6396

DSC_6391

DSC_6389

DSC_6384

DSC_6383

DSC_6382

DSC_6381

DSC_6378

DSC_6376

DSC_6349

DSC_6362

DSC_6367

DSC_6368

DSC_6369

DSC_6370

DSC_6371

DSC_6374

DSC_6375

DSC_6343

DSC_6341

DSC_6340

DSC_6330

DSC_6323

DSC_6322

DSC_6318

DSC_6317

DSC_6313

It is just so awesome to see how nature combines it’s various aspects together to create unimaginable blend of soothing beauty…

See the change of expressions… 🙂

Moon from my Camera's Lens

Beautiful Full Moon...

PWDENCRYPT & PWDCOMPARE are two undocumented methods provided by MS SQL Server. PWDENCRYPT generates a hash given a string, and PWDCOMPARE is used to Compare a string with generated hash.

Example:

DECLARE @varPassword NVARCHAR(128)
SELECT @varPassword = ‘Test Encryption’

DECLARE @passwordHash VARBINARY(128)
SELECT @passwordHash = PWDENCRYPT(@varPassword)

PRINT ‘Password: ’ + @varPassword
PRINT ‘Password Hash: ’ + CAST(@passwordHash AS NVARCHAR(128))

DECLARE @chkPassword NVARCHAR(128)
SELECT @chkPassword = ‘Test Encryption’

IF (PWDCOMPARE(@chkPassword, @passwordHash) = 1)
BEGIN
PRINT ‘Match found’
END
ELSE
PRINT ‘Match not found’

These methods work great as far as you are not expecting too much out of them. Let me put down some pros and cons which will help you make your choice regarding whether you should use these methods or not.

Pros:

  • Easy to use
  • Encryption/Decryption handled directly at SQL level
  • Easy to make bulk changes using queries
  • In built methods

Cons:

  • Case insensitive (now that’s a great problem if you are planning to use it for generating passwords)
  • Altering the collation settings does not help make it work consistently
  • Undocumented and hence not supported by Microsoft

Summary:

If you are in any way using PWDENCRYPT & PWDCOMPARE, you might want to go back and check for inconsistencies. I would personally recommend handling the encryption at Code level along with case sensitive collation on the SQL side for storing the encrypted values.

Wonder why many a times your ASP.NET website on migration from .NET 1.1 to .NET 2.0 starts giving all sorts of Javascript/AJAX errors? Why things don’t seem to work even when no code changes are made? Why Javascript works on your development environment but not on the production server? The reason behind all these problems is the web.config element ‘xhtmlConformance’.

What happens?

On migration from .NET 1.1 to .NET 2.0, the configuration element <xhtmlConformance  mode=”Legacy” /> is automatically added to you web.config file.

There are basically three values xhtmlConformance element can have:

  • Legacy (which is similar to how markup was rendered in previous versions of ASP.NET)
  • Transitional (XHTML 1.0 Transitional)
  • Strict (XHTML 1.0 Strict)

Why do the errors surface?

  • By default for many .NET 1.0 & .NET 1.1 servers controls, the rendering  is not XHTML compliant. ASP.NET 2.0 changed this and by default emits XHTML compliant markup from all controls
  • When xhtmlConformance is set to “Legacy” mode, it forces the controls to render in non XHTML compliant markup. What this does is, changes the ClientIDs generated for server controls
  • Most of the Javascripts use hardfixed ClientIDs for server controls. When the ClientIDs change, the Javascript is unable to locate the desired object/control & fails
  • For using AJAX, XHTML compliance needs to be met and hence this configuration will cause trouble in case you desire to use AJAX
  • Most websites have different web.config files for different environment i.e. development/testing/staging/production. In such cases the same code seems to work on one environment but not on the other because of difference in ‘xhtmlConformance’ element configurations

How to resolve these issues?

  • Remove ‘xhtmlConformance’ element from you web.conf file
  • Check for possible Javascript errors. If NO errors are found – ‘You’re so damn LUCKY!’
  • If you face Javascript errors, debug the Javascript, verify the ClientIDs generated on Page and those used by your Javascript. Usually, you will be able to resolve your problems by removing the extra ‘_’ from your Javascript ClientIDs

Hope it helps! 🙂

Archives

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2 other subscribers

Blog Stats

  • 1,384 hits