"Access Denied" JavaScript Error

I ran into an interesting issue this morning with one of the sites I’m working on.  I’m using Ajax and some JavaScript to do multiple things on my site.  We rolled the site out to production and started getting “Access Denied” JavaScript errors all over the site.  We were NOT getting these errors in test and I could not understand why.  I searched online to see if I could get any clues about how to fix this.  I found one article that discussed this error being related to security when working on window objects that are in two different domain (ie. trying to use “http://www.mydomain.com” and “http://mydomain.com” as config values on the same site).  So, the problem turned out to be that we were doing some domain forwarding and cloaking through zoneedit.com.  The cloaking displays “www.mydomain.com” in the address bar no matter what page you go to in the site.  Turning the cloaking off fixed the problem.  Cloaking is not a real high requirement for us so just turning that off is OK for us.  I’m not sure if there is a fix to get both the cloaking and the JavaScript to work.  Our site is working fine now so I’m not going to pursue it, but if someone finds the answer to that question please post that comment here for future reference.

Posted in | 1 comments

FYI For Vonage Users

This has nothing to do with .Net, but I thought there might be a bunch of people out there with Vonage that might be affected by this.

Vonage Patent Infringement

Posted in | 2 comments

Validator Control Errors when Upgrading to RTM Version of Ajax

Many of you may have already seen this and fixed it.  I know that I had dealt with this once before, but I could not remember the fix.  So, I figured I’d blog it so if\when I come accross it again I can use this post as a reference to the workaround.  Here is the scenario:

We have been using the CTP version(s) of Ajax for many months now.  The RTM version was released and the validation controls were moved to a different release and were not included in the RTM version.  These controls that were left out caused the following error:

Could not load type 'System.Web.UI.Compatibility.CompareValidator' from assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

There is a great post here or here that explains this error in more detail, but I will give you the cliff notes version real quick.  This error is directly related to these Web.Config entries:

<tagMapping>

<add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="System.Web.UI.Compatibility.CompareValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="System.Web.UI.Compatibility.CustomValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="System.Web.UI.Compatibility.RangeValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="System.Web.UI.Compatibility.RegularExpressionValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="System.Web.UI.Compatibility.RequiredFieldValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="System.Web.UI.Compatibility.ValidationSummary, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</tagMapping>

If you are not using any of these controls then you can simply remove these entries.  They are located in the <pages> section in the Web.Config.  I would try this first and recompile to see if this fixes the issue.  If you are using the Validation controls then you will need to download this dll and reference it from your web project.  You will aslo need to change the Web.Config settings from above to look like this:

<tagMapping>

<add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="Sample.Web.UI.Compatibility.CompareValidator, Validators, Version=1.0.0.0"/>

<add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="Sample.Web.UI.Compatibility.CustomValidator, Validators, Version=1.0.0.0"/>

<add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="Sample.Web.UI.Compatibility.RangeValidator, Validators, Version=1.0.0.0"/>

<add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="Sample.Web.UI.Compatibility.RegularExpressionValidator, Validators, Version=1.0.0.0"/>

<add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="Sample.Web.UI.Compatibility.RequiredFieldValidator, Validators, Version=1.0.0.0"/>

<add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="Sample.Web.UI.Compatibility.ValidationSummary, Validators, Version=1.0.0.0"/>

</tagMapping>

This should fix the problem.

Posted in | 0 comments

My Upcoming Speaking Events

Just wanted to put a quick update out here to let everyone know my schedule for the next couple of months.  Below is a list of my upcoming speaking engagements:

April 3rd: Launch Speaker at the Vista and Office 2007 Launch for the South Colorado .Net User Group

April 14th: Simple Design Patterns That Solve Real World Development Issues at the Code Camp in Salt Lake City Utah

May 21st: Simple Design Patterns That Solve Real World Development at the Denver .Net User’s Group

Please join me at these events to learn about .Net and have some fun as well.

Posted in | 0 comments

Vista Remote Desktop

Once you install Vista you start getting some annoying security messages when trying to remote from Vista to Servers or PCs that do not have the latest version of Remote Desktop.  I found a cool post on Scott Forsyth’s blog that discusses how to turn this off and the risks\rewards of doing so.  Check it out here.

Posted in | 1 comments

Test with new Version of Blog Jet

I just upgraded to the 2.0 version of Blogjet to see if i can get it to connect to my blog correctly.  Here are a few test pictures:

Vader Me

Posted in | 0 comments

A few things I learned about Vista yesterday

Just wanted to share a couple of things I learned about Vista yesterday. The first is the search capability. I had been getting to my files the old XP way. Opening Windows Explorer and navigating to the folder where the files reside. With Vista, if you open the Start Menu, you will see a search text box at the bottom. I guess I just ignored this or though it would use Windows Live to run an internet search. This search will search your computer for a bunch of things. It will search for programs, files, things in your web favorites and web history as well as all your emails. I recommend you give it a try. Type in “Vista” and see what you get. Secondly, you can create peer to peer wireless connections with Vista. You do not need a wireless router or anything special. I need to do some more research and testing. As a side note, a funny thing happened yesterday while the guy was demoing this. The presenter casually said “Let’s see if there are any wireless networks in my range”. He opened his network sharing center and said “There are some networks.” and walked away. The crowd started laughing. He didn’t look closely at the IDs of the networks and someone had created a peer to peer network named “Fukoff”. It was the first in his list in huge bold letters on the screens…. I learned tons of other stuff and I will try to put that in a few more posts.

Posted in | 0 comments

The .Net Runtime

I recently completed this Presentation for FDC. It went pretty well. The title of this presentation is a bit vague so I will explain what it covers. The first section is on how to create custom config setting either in the app.config or the web.config. The first demo uses the settings that are built in with Visual Studio 2005 then the next demo uses a custom section to work with some more advanced settings. The next pieces of the presentation are related to manged vs. unmanaged code and how to handle unmanaged resources safely. Then the presentation jumps into Reflection. The second demo builds on a previous demo and uses reflection to determine what file format to use for application logging. The final section deals with how to invoke unmanaged code from within .Net and also how to wrap your .Net code so it can be used by unmanaged applications. So, there is a melting pot of subject matter. If you have any questions please place some comments on this blog and I will get back to you. Here are the demos and the slides. DotNetRuntime.zip

Posted in | 0 comments

Do not upgrade to new Blogger.Com version if you use Third Party blogging software

I recently upgraded to the new version on Blogger.Com for this blog. I wish I wouldn't have because now I cannot get BlogJet to post anymore. The issue is that in order to use the new Blogger.Com you have to create a Google account to use as your login. Well, apparently the third party blogging apps do not know how to connect using your Google account. If I use my old username and password I get a msg stating that my old account was migrated to a Google account. If use the email address and password of my Google account I simple get an invalid user name and password msg. Very flustrating. I might have to look around for a new blogging engine in order to fix this. I recently upgraded to Vista and Office 2007 and I have tons of stuff to blog about, but I hate using the web interface.

Posted in | 3 comments

Inputs and Outputs

I recently completed this Presentation for FDC.  It went pretty well.  The main part of the demo is how to do file IO and compression.  There is also a bit of regular expressions and network stuff.  The network stuff i had never used.  When it comes to sending data and messages I usually use Web Services.  So, there is a Web Services demo included.  However, my final last ditch effort to get the Web Services demo working with the DeflaterStream failed.  It would not let me pass this stream as a parameter to my web service because it is not serializable.  I will work on that tonight to see if there is a fix.  Here are the demos and the slides.

InputOutput.zip (340 KB)

Posted in | 0 comments

SQL Server 2005 Disk Size Report

I previously blogged about a way to determine the sizes of your tables in a SQL 2005 DB.  That blog entry is still valid and is still useful.  There is a solution to this provided by SQL Server 2005.  The option has to be enabled on the server to be able to use it.  If it is available, you can click on the database, then in the summary window title bar click the “Report” drop down and select “Disk Usage”.  This report will give you the overall disk usage of the DB.  If you scroll down you will see a label named “Disk Usage By Tables”.  If you expand that you can get the table sizes in a grid that is similar to the one I previously blogged about.  So depending on what you need the data for and what security you have on the DB,  using one of my blog entries on this subject you should be able to get the table sizes.

Posted in | 6 comments

Book I recently read: Accelerated C# 2005 by Trey Nash, Apress

This is a great book if you are already familiar with object oriented languages such as Java or C++.  Unlike some of the other bricks out there on C# this book assumes you know object oriented coding and glosses over some of the basics.  It get’s right to the stuff you need to get up and running with C# quickly.  I also liked the first few chapters that explain the Common Language Runtime (CLR) and the .Net Framework.  These chapters give you the knowledge you need to understand how the system internals work and what the CLR and the .Net Framework take care of for you.  After that, the book mixes some chapters on the basic syntax of C# with some advanced concepts.  The basics include a general C# syntax overview, working with strings, and detailed info on Structs, Classes, Objects and Arrays.  It also includes some more advanced topics such as Threading, Generics, Delegates, Events and Operator Overloading.  Coming from an object oriented background I loved this book.

Posted in | 0 comments

Determining Table Sizes of Your DB in SQL 2005

I currently have a SQL 2005 database that seems larger than it should be.  It’s running about 5 gig, which is not very big, but once you add in all backups and such it is taking up too much space for my Virtual Server.  In SQL 2000 there was a HTML based page you could open to determine the size of you tables in number of rows and in KBs.  This page is nowhere to to be found in SQL 2005.  I did some research and came accross a great article on how to get this information here.  I will also detail how I handled it below:

First I created a table in my DB named TableSizes.  Here is the script for that:

CREATE TABLE [dbo].[TableSizes](

            [tablename] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

            [rows] [int] NULL,

            [reserved] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

            [reserved_int] [int] NULL CONSTRAINT [DF__TableSize__reser__33928E3B]  DEFAULT ((0)),

            [data] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

            [data_int] [int] NULL CONSTRAINT [DF__TableSize__data___3486B274]  DEFAULT ((0)),

            [index_size] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

            [index_size_int] [int] NULL CONSTRAINT [DF__TableSize__index__357AD6AD]  DEFAULT ((0)),

            [unused] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

            [unused_int] [int] NULL CONSTRAINT [DF__TableSize__unuse__366EFAE6]  DEFAULT ((0))

) ON [PRIMARY]

Next I created a the stored proc similar to the one in the article I mentioned above.  Except instead of using a temp table I’m storing the data in my TableSizes table.  I don’t have anything against temp tables I just like the idea of that data being saved of so I can use it later for reporting and such.  Here is the stored proc:

CREATE PROCEDURE dbo.spPopulateTableSize

AS

 

truncate table TableSizes

 

-- Populate the temp table...

EXEC sp_MSforeachtable @command1=

         "INSERT INTO TableSizes

           ([tablename],[rows],[reserved],[data],[index_size],[unused])

          EXEC sp_spaceused '?'"

  

-- Strip out the " KB" portion from the fields

UPDATE TableSizes SET

   [reserved_int] = CAST(SUBSTRING([reserved], 1,

                             CHARINDEX(' ', [reserved])) AS int),

   [data_int] = CAST(SUBSTRING([data], 1,

                             CHARINDEX(' ', [data])) AS int),

   [index_size_int] = CAST(SUBSTRING([index_size], 1,

                             CHARINDEX(' ', [index_size])) AS int),

   [unused_int] = CAST(SUBSTRING([unused], 1,

                             CHARINDEX(' ', [unused])) AS int)

  

-- Return the results...

SELECT * FROM TableSizes order by tablename

So now I can call this SP anytime I want and get a great view of the tables, and thier sizes, in my DB.  Hope this helps!

Posted in | 2 comments

Select Method on a DataTable

I thought I would bring this up as an FYI.  This method is very useful for doing in memory searches of your DataTables.  The Select method takes a filter expression as a parameter and returns an array of DataRows that can be looped through.  It’s also a very easy way to determine if certain rows exist in your DataTable.  If you do the select and the length of the array returned is zero, then no rows exist and you can move on.  I’ve used it a few times and thought I’d pass it along.

Posted in | 0 comments

Creational Design Patterns

I completed my presentation on Creational Design Patterns and presented it last Monday.  Sorry for the delay in getting the samples out here!  I took some time off over the Thanksgiving Holiday.  Thanks again to FDC for having me!  If you have any questions or comments about the presentation please feel free to comment on this blog or email me.  Here is the presentation and the demos:

 Creationa Design Patterns.zip

Posted in | 0 comments

.Net Framework 3.0 Free E-Learning

Just an FYI there are three free 2 hour courses available from MS E-Learning on .Net Framework 3.0.  There is a class for WPF, Workflow, and WCF.  I think they are just intro classes, but the prerequisites make it sound like they might get into some deep content.  I just signed up so I will keep everyone updated as I go through the classes.  Here is the link if you want to check it out.

https://www.microsoftelearning.com/eLearning/offerDetail.aspx?offerPriceId=109340

Posted in | 0 comments

Behavioral Design Patterns

I completed my presentation on Behavioral Design Patterns and presented it this morning.  Thanks again to FDC for having me!  If you have any questions or comments about the presentation please feel free to comment on this blog or email me.  Here is the presentation and the demos:

Behavioral Design Patterns.zip

Posted in | 0 comments

Determining the website that belongs to an IIS process

Today I ran into an issue where there was a w3wp.exe process running on my server that was pegging the CPU.  The only thing I could find about it was that it was running under the user name of NETWORK SERVICE.  I had no idea what site was causing the issue.  I searched online and found this command:

c:\windows\system32\iisapp.vbs

Run this from the command prompt and it will give you the PID to web site mapping.  You might also have to add the PID column to your Windows Task Manager.  Click View.. Select Columns to add this column.

Good Luck…

Posted in | 0 comments

Do you need a car or a USB jump drive?

Posted in | 0 comments

Events and Structural Design Patterns

Thanks FDC for having me for the Events and Structural Design Patterns Talk! I hope you got enough out of it to help you complete your drills or to help you retain some of the concepts from the drills. I would also like to thank those of you who attended this session at the South Colorado Code Camp on Saturday. I hope you got as much out of code camp as I did. I would appreciate any comments on how I can make the talk better. Just email me or insert a comment to this blog post. Here is a link to the zip file with the demos and slides: Events And Structural Design Patterns.zip

Posted in | 1 comments