Where is Aspnet_setreg.exe source code?

August 8th, 2005 No comments

Various places (including http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfIdentitySection.asp), say:
You can create the encrypted credentials and store them in the registry with the ASP.NET Set Registry console application (Aspnet_setreg.exe), which uses CryptProtectData to accomplish the encryption. To download Aspnet_setreg.exe, along with the Visual C++ source code and documentation, visit the Web site www.asp.net and search for “aspnet_setreg”.I have been unable to locate the source code for this program. The best I could find on www.asp.net was a forum thread by someone asking where the source code is, and none having an answer.)
So, where is the source code?! I am looking to duplicate its functionality in my program.

Categories: Uncategorized Tags:

SP4 might slow down your single instance of sql server 2000

August 8th, 2005 No comments

if  Address Windowing Extensions(AWE) has been enabled on a single instance of sql server 2000, after applying SP4, you got to apply .2040 hotfix as well, otherwise your SQL server instance only uses 50% of the available physical memory that sucks:).


1) run the following script from SQL Query Analyzer to determine if AWE is enabled on the server :


sp_configure ‘show advanced options’, 1
go
reconfigure
go
sp_configure ‘awe enabled’
go


If run_value is set to 1, AWE is enabled on the server.


2) BTW After applying the SP4, just make sure that it has been installed properly as I’ve heard that some broken installations of SP4 are not reported properly. Run the following query in Analyzer and you should get the following results.


 Query in Query Analyzer:


SELECT SERVERPROPERTY(‘productversion’) 
SELECT SERVERPROPERTY(‘productlevel’)


Result after applying SP4:


 8.00.2039 
SP4


Result after applying SP4 and its hotfix :


 8.00.2040 
SP4
 

Categories: Uncategorized Tags:

Asynchronous JavaScript and XML (AJAX)

August 2nd, 2005 No comments

Michael Schwarz has built an amazing library (AJAX) to allow server-side processing without requiring postback.In fact his framework exposes a functionality to asynchronously sending and receiving HTTP Requests and HTTP Responses to and from the server. I guess Google suggest and Google map are both using the same technique. I’m sure that AJAX will change the asynchronous design patterns and will have a great impact on separating tiers in application architecture soon. Here is the definition of AJAX I found in Wikipedia.


Categories: Uncategorized Tags:

Why do I set Debug=False in my ASP.NET Applications when they go live in production?

August 1st, 2005 No comments

A web.config of an ASP.NET application has a compilation element which exposes a Debug attribute that can be set to either “True” to produce release(retail) binaries or “False” for debug binaries.In both cases what is ultimately generated is binary ,but the way they are generated and the way they affect general performance of your ASP.NET application is very different.



  1. In most of the cases I don’t really need each page of my ASP.NET application to be compiled individually into separate assemblies (Debug=”True”). I know the cost of loading each assembly into memory and how it kills the performance. I would even delete global.asax for small ASP.NET applications where I don’t use it at all as it is also compiled into a separate assembly.
  2. I do really need the pages under each folder to be batch-compiled by arriving of the first request rather than multiple compilations upon requests to different pages. Be informed that batch compilation occurs at the directory level, not the application level and there is no batch-compilation when Debug=”True”.
  3. Many people bring up some lame excuses that our web server is behind the firewall and who cares about the security!!!! Well, that’s ludicrous that people never think about the problem ahead till they are in trouble. I’d say driving a hummer doesn’t mean that you shouldn’t buckle up, Firewall is cool but it doesn’t mean that you as a developer should forget about the security principles that you must consider in the project’s life cycle. When Debug=”True” is specified debug symbol file, compiler command line file, compiler output file, etc are all compiled and placed in the “WindowsMicrosoft.NETFrameworkv1.1.4322Temporary ASP.NET” in addition to the assembly. It means your source code is deployed to the production server and can easily be deciphered.Beside that the inclusion of debug information ALSO reduces performance. (but allows a debugger to be attached to step through the assembly’s code, and also allows ASP.NET to provide additional information when an exception is thrown such as the line on which the exception was thrown)

Microsoft offers an excellent whitepaper which I really suggest you to read before deploying your application to the production server.


 

Categories: Uncategorized Tags:

TimeStamp VS DateTime data types in SQL SERVER

July 30th, 2005 No comments

Couple years ago I was struggling a bit with timestamp (Also known as ROWVERSION) and DateTime data types in Sql Server as I wanted to have the date and time of when each record in Table is modified in my application. Yesterday I saw couple of posts in the newsgroups in this regards so I decided to explain it again here for those who have the same issue.


If you want to have the last modified date and time of each record then you have two options:


1) Define the field as datetime in your database and then in your stored procedure use something like this:


CREATE PROC NWtest
@endDate datetime = NULL
AS
IF @enddate IS NULL
SET @endDate = GetDate()
SELECT OrderDate
FROM Northwind.dbo.Orders
WHERE OrderDate<@enddate
Order By OrderDate
GO


The reason is that the default in storedproc must be a constant or NULL


2) Open the table in Design mode in enterprise manager(Or much better, use ALTER TABLE in Query Analyzer), find the column, and in the “Default Value” enter (GETDATE()).Now you won’t have to worry about populating that column in any procedures Because SQL Server will put in the current date and time when the record is
inserted.


TIMESTAMP is an unfortunate misnomer, as the data stored here really has nothing to do with TIME at all.  ROWVERSION is an equivalent data type and is the syntax I recommend when using to track changes to a row, if for nothing else, to avoid this very ambiguity.  Also, I heard that in some future version of SQL Server, the TIMESTAMP designation will go away.You can see these articles:
http://www.aspfaq.com/2448
http://www.aspfaq.com/2499


Having said this ,I thought that when do people ever use timestamp – I mean, why was it ever included. I understand it to be an 8 byte binary number that changes when a record changes, and is unique within the scope of a database, but I don’t see the benifits of using it.  It doesn’t provide an audit trail of row data as far as I know, and is not a candidate for PK as it changes over time.What benifits are there for using it?. I put my newbie hat on and I did some goole searches 😉


Answer:


Optimistic concurrency ( Simple ,isn’t it? :-)).When you read a row to present to a user, read and store the value in the timestamp column, When you later issue the UPDATE:


UPDATE tbl
SET …
WHERE pkCol = Your_Primary_Key_Value
AND tsCol = OriginalTimeStampValue


Then check number of rows modified by the UPDATE. If 0, the row was either deleted or changed or updated by somebody else while you were looking at it.
 

Categories: Uncategorized Tags: