Sunday, July 09, 2006

Setting up membership for your ASP.Net website is pretty simple. All you need to do is:

  1.  run the scripts using the aspnet_regsql.ext tool (C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regsql.exe    your version number may be diferent) to set up the database tables.
  2. Add a membership section to your web.config. Making sure that you add the <clear/> tag since you need to override the machine.config.

       41     <membership>

       42       <providers>

       43         <clear/>

       44         <add name="AspNetSqlMembershipProvider"

       45                   type="System.Web.Security.SqlMembershipProvider,
                             System.Web, Version=2.0.0.0, Culture=neutral,
                             PublicKeyToken=b03f5f7f11d50a3a
    "

       46                   connectionStringName="LocalSqlServer"

       47                   enablePasswordRetrieval="false"

       48                   enablePasswordReset="true"

       49                   requiresQuestionAndAnswer="true"

       50                   applicationName="/"

       51                   requiresUniqueEmail="false"

       52                   minRequiredPasswordLength="1"

       53                   minRequiredNonalphanumericCharacters="0"

       54                   passwordFormat="Hashed"

       55                   maxInvalidPasswordAttempts="5"

       56                   passwordAttemptWindow="10"

       57                   passwordStrengthRegularExpression="" />

       58       </providers>

       59     </membership>

       60   </system.web>

  3. Add a connection string once again using the <clear/>  tag to clear out the machine.config settings. (I will tell you why soon) 

       16   <connectionStrings>

       17     <clear/>

       18     <add name="LocalSqlServer" connectionString="Data
                 Source=xxx;Initial Catalog=xxx;Persist Security
                 Info=True;User ID=xxxx; password=xxx
    " />

       19   </connectionStrings>


  4. Then load up the Web Site Administration Tool by going to Website\Asp.Net Configuration in VS2005.

  5. You will then be about to configure your membership using SQL2000/2005 using this tool.

So where is the gotcha you might ask?  Well, if you try to name your connection string anything other than LocalSqlServer, when you get to the provider tab you will see a message that says "No Provider Created".  This is why you need to clear out the connection string section using the  <clear/> tag so that you can override the setting in the machine.config.  

 

I hope that helps someone.

Happy Programming

 

Doc


posted on Sunday, July 09, 2006 11:10:27 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Friday, July 07, 2006

I was just talking to a possible client the other day when the inevitable subject of "Which Technology is the Best" came up. He was a designer but also did a little bit of PHP. The reason he used PHP was because that was what his other Designer friends used.  This of course started up the "Which is better" argument/discussion.

I have always firmly held the stance that :  I JUST DONT CARE. 

C# or VB.Net, which is better?   Who cares?  What is the client paying for? I program in both, and you should too.

ASP/ASP.Net or PHP?  Who Cares,  how many jobs can I get doing PHP sites and how many with ASP/ASP.Net. ( You may have noticed that I did not even go into the enormous difference between PHP and ASP.Net)

The bottom line is, go where you can find work AND do it well!!!  Whatever you do.  

On that note, I found a great blog post that talks about this HERE.  Check it out.

Happy Programming!

DotNetDoc

posted on Saturday, July 08, 2006 1:56:32 AM (GMT Daylight Time, UTC+01:00)  #    Comments [3] Trackback

OK... So one of the blogs I read is from a very technical person who writes a very non-technical blog. Most of the .Net world already knows who his is but if you have been living on another planet, his name is Rory Blyth.

Now his blog can get a little over the top for me sometimes but it is usually hysterically funny.  So I was going through some emails recently and I came across a couple of his posts that I had emailed to someone. The cracked me up all over again.

So I thought I would share them:

The first one is about his experience with T-Mobile and their phone system. Maybe you need to be a customer to find this funny but ..... well maybe not.

http://neopoleon.com/blog/posts/14880.aspx

The second one is more of a cartoon then a blog post. If you have ever worked in a corporate environment, you will definitely get a kick out of this. On the other hand, if you say "I don't get it", then you are management material all the way!!

 http://www.neopoleon.com/blog/posts/434.aspx

Enjoy

DotNetDoc

 

 

posted on Saturday, July 08, 2006 12:08:18 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Thursday, July 06, 2006

As part of DotNetDoc's new "Ask the Doc" format, we are starting our journey by taking a page from the Zen Master himself Scott Hanselman. We will be walking through his list of questions posted in his, "What Great .NET Developers Ought To Know" post. We will not only try to answer the questions but give each a "deep dive" so that we not only can answer the question, but so that we UNDERSTAND the answer. We will go one question at a time until we reach the end. I hope you enjoy, and thanks Scott for the thought provoking questions.

.Net Ought To Know #4 : What is the difference between an EXE and a DLL?

The main difference between an EXE and a DLL is the fact that an EXE contains instructions for the processor and has an entry point for the execution to start. In this .Net Drag and Drop world where most of the underlying tasks are taken care of for us, this is sometimes hard to see. In the classes I teach, in order to focus on the the code and not the bells and whistles, I often assign Console Applications for homework. The entry point for a console application is the Sub Main() procedure. You can see this by going to project properties and looking at the Startup object. Since a console application will create an EXE, it needs to know where to start execution.

 

 

If we change the Application type from Console Application to Class Library, you will notice that the Startup object type now says <none>. This is because a DLL cannot be executed(or loaded)directly, it can only be called by another process.

 


It is also interesting to note how this question relates to .Net Ought To Know #3. An EXE runs in its own address space(out-of-process) while a DLL will run in the address space of its host (in-process). If you wanted to dive deeper into this, you could load up both a DLL and EXE in ILDasm.exe and look for the <entrypoint> marker in the EXE file.

Happy Programing.

Doc

posted on Thursday, July 06, 2006 4:44:18 AM (GMT Daylight Time, UTC+01:00)  #    Comments [1] Trackback
Monday, July 03, 2006

As part of DotNetDoc's new "Ask the Doc" format, we are starting our journey by taking a page from the Zen Master himself Scott Hanselman. We will be walking through his list of questions posted in his, "What Great .NET Developers Ought To Know" post. We will not only try to answer the questions but give each a "deep dive" so that we not only can answer the question, but so that we UNDERSTAND the answer. We will go one question at a time until we reach the end. I hope you enjoy, and thanks Scott for the thought provoking questions.

.Net Ought To Know #3 : What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?

Well since most people are still not using a 64 bit operating system, we are going to keep this discussion limited to a 32bit OS. In the NT Flavor of operating systems, 4GB of memory is available to each process but it is split 50/50 with with the operating system.

So each process has 2GB of memory available for its private use. The other 2GB is used by the operating system, devices, graphics cards, etc.. Keep in mind, the 4GB/2GB size is regardless of how much RAM you have installed.

This would affect system design if you are creating an application that uses very large data structures or applications like mail servers, database management servers etc.. To address the need for more memory space, you can use a /3GB switch which then splits the memory usage from 50/50 to 75/25. Allowing your application to use 3GB of the 4GB available.

Happy Programming

Doc

posted on Tuesday, July 04, 2006 1:17:21 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Friday, June 02, 2006

Just an FYI.. I will be apprearing at UCLA on Saturday as part of their Masters Series.  If you are interested, you can check here.

http://ladotnet.org/

DotNetDoc

posted on Friday, June 02, 2006 7:14:30 AM (GMT Daylight Time, UTC+01:00)  #    Comments [2] Trackback
Saturday, May 27, 2006

SQL PROMPT - From Red Gate Software

While I was reading some blogs today I came accross THIS from Scott Mitchell.   SQL Prompt from Red Gate software. It gives you IntelliSense for SQL. Pretty cool stuff. The best part is that it is FREE. Check it out HERE.

Doc

posted on Saturday, May 27, 2006 9:20:01 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Tuesday, May 23, 2006

I received a question today from one of my readers. (1 of the 10 I guess. LOL ) about VS2005 web projects.

Doc,

    I am trying to add some class code to my website project and it does not seem to want to recognize the namespace that I am using. When I create a namespace in my aspx files I can see them but not in my class files. What am I doing wrong?

This is a common mistake for those who are new to VS2005.  Since you are now able to point to a folder on your drive and bring up a web project without setting up an IIS virtual directory, you need to do things a  bit different. All class files need to be put in a special folder called App_Code. This folder will automatically be compiled at run time. You can use it to store .cs, .vb, xsd, wsdl etc..

The compiler will look to see what extension .cs or .vb your files have and use that languages compiler for C# or VB respectively. The code is then compiled into a single assembly and is made available to the code in your project. This means that you cannot have files of different languages inside this folder.

Or can you...?

By placing a <compilation><codeSubDirectory> set of tags in your web.config. The compiler will create separate assemblies for each folder. Of course, you have to put the files of like type into those folders.

<configuration>
   <system.web>
      <compilation>
         <codeSubDirectories>
           <codeSubDirectory directoryName="/aspnet/code/mySubDir1"/>
           <codeSubDirectory directoryName="/aspnet/code/mySubDir2"/>
           <codeSubDirectory directoryName="/aspnet/code/mySubDir3"/>
         </codeSubDirectories>
      </compilation>
   </system.web>
</configuration>
Hope that helped.
Happy Programming!
Doc
posted on Wednesday, May 24, 2006 1:32:03 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback

Code Monkey @ Code Camp

OK. So most of you know that we put on the "Rock and Roll" Code Camp here in Southern California. The next one is coming up June 24th and 25th in San Diego (http://www.SoCalCodeCamp.org) but the cool thing is that I just got back an email from Jonathan Colton (http://www.jonathancoulton.com) and he is going to make a Code Monkey @ Code Camp version of his shirts that we will giving out at the code camp. Pretty cool stuff. If you have not heard his new code monkey song you have to check it out.  (http://www.jonathancoulton.com/music/thingaweek/CodeMonkey.mp3) You will love it. (It will stop playing about 1/2 way through. You can get the full version on his site for a buck!!  Well worth the price don't you think)

Thanks Jonathan.

posted on Tuesday, May 23, 2006 11:15:04 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Saturday, May 20, 2006

p>As part of DotNetDoc's new "Ask the Doc" format, we are starting our journey by taking a page from the Zen Master himself Scott Hanselman. We will be walking through his list of questions posted in his, "What Great .NET Developers Ought To Know" post. We will not only try to answer the questions but give each a "deep dive" so that we not only can answer the question, but so that we UNDERSTAND the answer. We will go one question at a time until we reach the end. I hope you enjoy, and thanks Scott for the thought provoking questions.

.Net Ought To Know #2 : What is a Windows Service and how does it's lifecycle differ from a standard EXE?

Whenever a user logs onto a NT flavor machine, they are given a desktop to work with. Any of the programs that are run, any of the processes that are started belong to this user. Only one user can be logged on at one time.

If you go to windows explorer and navigate to the Documents and Settings folder you will see all of the different users that have used your machine. Only one of these profile (or desktops) can be active at a time. Different rights can be given to each of the users of the system which can control what they can see and what they can do. Standard EXE's are run by users that are logged onto the system. This is accomplished by either navigating to the shortcut associated with the application (either on the programs menu or the desktop) and clicking on the icon. This will run that application using the rights of the currently logged on user. You can also run as another user by right-clicking on the icon and selecting run-as from the context menu, but you get the picture. Standard EXE's are associated with the current user and their desktop.

Windows Services, on the other hand, are processes that can exist and run without a user/desktop. The windows service runs in its own windows session without the need for any particular user to be logged onto the system. They are initiated when the system boots up. As opposed to a Standard EXE, they have no user interface as they run in the background of your computer.

 

 

 

 

 

 

 

 

You can view all the Windows Services running on your computer by using the Computer Management Console. This can be opened by clicking on the services icon found in your control panel. Many of the applications found in here will be familiar to you like SQL Server (MSSQLSERVER for 2000 or SQL Server * for 2005) or Task Scheduler, but others will not be, like Network DDE or Logical Disk Manager.

 

 

 

 

 

 

 

To discover what a Windows Service is used for, just click on the service and the description will be shown on the left of the screen. Finally, you can also decide when a service will start. You have three choices :

  • Automatic -
    When this setting is selected, the Windows Service will start when the system is started.
  • Manual -
    When this setting is selected, the Windows Service will not be started until the "Start the Service" link is selected. This can also be automated by an application but the main difference is that it is not started during the system boot up.
  • Disabled -
    Well, this of course means that the service is disabled.

So the lifecycle of a Windows Service is different from the lifecycle of a Standard EXE because a Windows Service is associated with the system (but can use any account) and begins its "life" when the system boots up. A Standard EXE needs a signed on user(manually or programmaticlly)to initiate its instantiation.

Happy Programming.

DotNetDoc

 

posted on Saturday, May 20, 2006 11:26:16 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback