October 2006 - Posts

Secure TextBox Updated
Sunday, October 29, 2006 4:53 PM

There has been quite some interest in my SecureTextBox control that I developed. Basically it offers textual entry via a standard textbox, but uses the SecureString as its internal storage. Typically aimed at entering passwords and similar secure information on a windows form.

Domink Zemp recently downloaded the control and has been using it with good success. He was also nice enough to forward some changes and improvements to the control to better handle the TAB, ENTER and ESCAPE keys. The new code has been posted on my site here. (http://www.theglavs.com/DownloadItem.aspx?FileID=46).

Incidentally, its been one of my more popular downloads. Its now clocked in at around 2500 downloads and steadily climbing.

It had a good plug from one of the Microsoft guys over in Hong Kong too. You can read about it here. It was used as collateral for a security presentation that was being delivered. Pretty cool.

Anyway, special thanks to Dominik who was nice enough to send through the changes to improve the control. Its always nice to hear from the community, how something is going, after you've let something loose in the community.

Update: I have recently updated this control based on "Wout's" bug fixes and changes and also added a new feature to confirm clearing the clipboard when you paste in some text. (Note: See comments below). Thanks Wout!

More on ASP.NET AJAX Web Service Proxies
Thursday, October 26, 2006 10:52 AM

Previously, I posted about the difference between the proxies generated by the earlier CTP release, and the current Beta 1 release.

In that post, I noted how much different the proxies were in the latest Beta 1 release. They are obviously much larger.

To get the proxy code, I simply navigated to my .ASMX page that contained my web service and appended a "/JS" to the url address. Something like:

http://localhost:49463/TestSite/SampleService.asmx/js

Well, you can weight your page down even more by requesting the debug versions of scripts, and additionally, the web service proxies themselves.

You can look at the debug version of a web service proxy by appending "/JSDEBUG" to your web service URL. So the above URL now becomes:

http://localhost:49463/TestSite/SampleService.asmx/jsdebug

and yields the code below (I hope your ready, its big...). You will note the extensive use of comments. Again, this is (IMO) for the upcoming Orcas release and improved debugging, intellisense support.

Note that the debug version of the proxy is generated when you have <compilation debug="true"> in your web.config file.

Type.registerNamespace('Test');
Test.SampleService=function() {
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
}
Test.SampleService.prototype={
HelloServer:function(succeededCallback, failedCallback, userContext) {
/// <summary>Invoke the HelloServer WebMethod</summary>
/// <param name="succeededCallback" type="function" optional="true">Callback on successful completion of request</param>
/// <param name="failedCallback" type="function" optional="true">Callback on failure of request</param>
/// <param name="userContext" optional="true">User context data (any JavaScript type)</param>
return Sys.Net._WebMethod._invoke.apply(null, [ this, 'HelloServer','Test.SampleService.HelloServer',false,{},succeededCallback, failedCallback, userContext]); },
Search:function(prefixText,count,succeededCallback, failedCallback, userContext) {
/// <summary>Invoke the Search WebMethod</summary>
/// <param name="prefixText">WebMethod parameter: prefixText(type: String)</param>
/// <param name="count">WebMethod parameter: count(type: Int32)</param>
/// <param name="succeededCallback" type="function" optional="true">Callback on successful completion of request</param>
/// <param name="failedCallback" type="function" optional="true">Callback on failure of request</param>
/// <param name="userContext" optional="true">User context data (any JavaScript type)</param>
return Sys.Net._WebMethod._invoke.apply(null, [ this, 'Search','Test.SampleService.Search',false,{prefixText:prefixText,count:count},succeededCallback, failedCallback, userContext]); },_get_path: function() { return Test.SampleService.get_path(); },

set_timeout: function(value) {
/// <summary>Sets the timeout for this service.</summary>
/// <param name="value" type="Number">The timeout in milliseconds.</param>
var e = Function._validateParams(arguments, [{name: 'timeout', type: Number}]);
if (e) throw e;
if (value < 0) {
throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout);
}
this._timeout = value;
},
get_timeout: function() {
/// <summary>Returns the timeout in milliseconds for this service.</summary>
/// <returns type="Number">The timeout in milliseconds for the service.</returns>
return this._timeout;
},
set_defaultUserContext: function(value) {
/// <summary>Sets the default userContext for this service.</summary>
/// <param name="value">The default userContext for this service.</param>
this._userContext = value;
},
get_defaultUserContext: function() {
/// <summary>Returns the default userContext for this service.</summary>
/// <returns>Returns the default userContext for this service.</returns>
return this._userContext;
},
set_defaultSucceededCallback: function(value) {
/// <summary>Sets the default succeededCallback for this service.</summary>
/// <param name="value" type="Function">The default succeededCallback for this service.</param>
var e = Function._validateParams(arguments, [{name: 'defaultSucceededCallback', type: Function}]);
if (e) throw e;
this._succeeded = value;
},
get_defaultSucceededCallback: function() {
/// <summary>Returns the default succeededCallback for this service.</summary>
/// <returns type="Function">Returns the default succeededCallback for this service.</returns>
return this._succeeded;
},
set_defaultFailedCallback: function(value) {
/// <summary>Sets the default FailedCallback for this service.</summary>
/// <param name="value" type="Function">The default FailedCallback for this service.</param>
var e = Function._validateParams(arguments, [{name: 'set_defaultFailedCallback', type: Function}]);
if (e) throw e;
this._failed = value;
},
get_defaultFailedCallback: function() {
/// <summary>Returns the default failedCallback for this service.</summary>
/// <returns type="Function">Returns the default failedCallback for this service.</returns>
return this._failed;
}
}
Test.SampleService._staticInstance = new Test.SampleService();
Test.SampleService.set_path = function(value) {
/// <summary>Sets the service url.</summary>
/// <param name="path" type="String">The service url.
var e = Function._validateParams(arguments, [{name: 'path', type: String}]); if (e) throw e; Test.SampleService._staticInstance._path = value; }
Test.SampleService.get_path = function() {
/// <summary>Returns the service url.</summary>
/// <returns type="String">The service url.</returns>
return Test.SampleService._staticInstance._path; }
Test.SampleService.set_timeout = function(value) {
/// <summary>Sets the service timeout.</summary>
/// <param name="value" type="Number">The service timeout.
var e = Function._validateParams(arguments, [{name: 'timeout', type: Number}]); if (e) throw e; if (value < 0) { throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout); }
Test.SampleService._staticInstance._timeout = value; }
Test.SampleService.get_timeout = function() {
/// <summary>Returns the service timeout.</summary>
/// <returns type="Number">The service timeout.</returns>
return Test.SampleService._staticInstance._timeout; }
Test.SampleService.set_defaultUserContext = function(value) {
/// <summary>Sets the service default userContext.</summary>
/// <param name="value">The service default user context.
Test.SampleService._staticInstance._userContext = value; }
Test.SampleService.get_defaultUserContext = function() {
/// <summary>Returns the service default user context.</summary>
/// <returns>The service default user context.</returns>
return Test.SampleService._staticInstance._userContext; }
Test.SampleService.set_defaultSucceededCallback = function(value) {
/// <summary>Sets the service default succeeded callback.</summary>
/// <param name="value" type="Function">The service default succeed callback function.
var e = Function._validateParams(arguments, [{name: 'defaultSucceededCallback', type: Function}]); if (e) throw e; Test.SampleService._staticInstance._succeeded = value; }
Test.SampleService.get_defaultSucceededCallback = function() {
/// <summary>Returns the service default succeeded callback.</summary>
/// <returns type="Function">The service default succeeded callback.</returns>
return Test.SampleService._staticInstance._succeeded; }
Test.SampleService.set_defaultFailedCallback = function(value) {
/// <summary>Sets the service default failed callback function.</summary>
/// <param name="value" type="Function">The service default failed callback function.
var e = Function._validateParams(arguments, [{name: 'defaultFailedCallback', type: Function}]); if (e) throw e; Test.SampleService._staticInstance._failed = value; }
Test.SampleService.get_defaultFailedCallback = function() {
/// <summary>Returns the service default failed callback function.</summary>
/// <returns type="Function">The service default failed callback function.</returns>
return Test.SampleService._staticInstance._failed; }
Test.SampleService.set_path("/ASPNET_AJAX_ServerControls/WebServices/SampleService.asmx");
Test.SampleService.HelloServer= function(onSuccess,onFailed,userContext) { /// <summary>Invoke the HelloServer WebMethod</summary>
/// <param name="succeededCallback" type="function" optional="true">Callback on successful completion of request</param>
/// <param name="failedCallback" type="function" optional="true">Callback on failure of request</param>
/// <param name="userContext" optional="true">User context data (any JavaScript type)</param>
Test.SampleService._staticInstance.HelloServer(onSuccess,onFailed,userContext); }
Test.SampleService.Search= function(prefixText,count,onSuccess,onFailed,userContext) { /// <summary>Invoke the Search WebMethod</summary>
/// <param name="prefixText">WebMethod parameter: prefixText(type: String)</param>
/// <param name="count">WebMethod parameter: count(type: Int32)</param>
/// <param name="succeededCallback" type="function" optional="true">Callback on successful completion of request</param>
/// <param name="failedCallback" type="function" optional="true">Callback on failure of request</param>
/// <param name="userContext" optional="true">User context data (any JavaScript type)</param>
Test.SampleService._staticInstance.Search(prefixText,count,onSuccess,onFailed,userContext); }

by Glav | with no comments
Filed under: , ,
VS2005, Project files and Assembly References
Wednesday, October 25, 2006 5:37 PM

In a project I am working with, I was migrating some projects from V1.1 to V2.0 of .Net, compiling and building all very happily, until another developer grabbed the latest code from source safe and found that a bunch of assembly references were invalid and therefore the project could not build.

Due to the large nature of the application, many parts had been broken into individual assemblies, with only those assemblies being referenced, not the project themselves.

In my migrated projects, it turned out some of the assembly references which I re-added, were not being resolved. Upon closer inspection of these project files, I saw the following:

<Reference include=”MyAssembly, Version=1.0.0.0, Culture=neutral” />

Obviously there is no path in there so it could not be resolved, however in some other projects in the same solution, and referencing the same assembly, I saw:

<Reference include=”MyAssembly”>
   <Name>MyAssembly</Name>
 
 <HintPath>..\..\..\..\..\Common\Lib\Assemblies\MyAssembly.dll</HintPath>
</Reference>

Which was being resolved successfully, as you would expect because of the extra <HintPath> element. I found in the offending project, that adding other assemblies from the same directory as the "MyAssembly" still yielded no <HintPath> element. So what was the difference between the 2?

After some investigation, I found that the offending project had some ReferencePath directories defined, one of the directories defined being the location of "MyAssembly", whereas in the working project, no ReferencePath settings were there. The ReferencePath settings can be seen by right clicking on your project in Visual Studio 2005 and selecting properties, then the ReferencePath tab.

The ReferencePath settings are actually stored in a .user file, which are not normally checked in, so when the developer got the latest code, the project file contained no <HintPath> settings, but also, his project had no ReferencePath settings defined, therefore the assemblies could not be resolved, and the build failed.

If you are setting up solutions and projects for your company, particularly large complex solutions, it pays to be aware of this behavour.

by Glav | 1 comment(s)
Filed under: ,
ASP.NET AJAX Web Service Proxies
Tuesday, October 24, 2006 11:43 PM

You have no doubt seen the multitude of posts talking about some of the many changes in the beta release of the ASP.NET AJAX libraries compared to the CTP releases.

Well, here is another....

Below is a CTP generated proxy of a web service:

Type.registerNamespace('Test'); Test.SampleService=new function() { this.appPath = "http://localhost:2455/AtlasServerControls/"; var cm=Sys.Net.ServiceMethod.createProxyMethod; cm(this,"HelloServer"); cm(this,"Search","prefixText","count"); }

And here is a Beta 1 generated proxy of the same web service:

Type.registerNamespace('Test');
Test.SampleService=function() {
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
}
Test.SampleService.prototype={
HelloServer:Sys.Net._WebMethod._createProxyMethod(this,"HelloServer", "Test.SampleService.HelloServer",false),
Search:Sys.Net._WebMethod._createProxyMethod(this,"Search", "Test.SampleService.Search",false,"prefixText","count"),_get_path: function() { return Test.SampleService.get_path(); },
set_timeout: function(value) { this._timeout = value; },
get_timeout: function() { return this._timeout; },
set_defaultUserContext: function(value) { this._userContext = value; },
get_defaultUserContext: function() { return this._userContext; },
set_defaultSucceededCallback: function(value) { this._succeeded = value; },
get_defaultSucceededCallback: function() { return this._succeeded; },
set_defaultFailedCallback: function(value) { this._failed = value; },
get_defaultFailedCallback: function() { return this._failed; }
}
Test.SampleService._staticInstance = new Test.SampleService();
Test.SampleService.set_path = function(value) { Test.SampleService._staticInstance._path = value; }
Test.SampleService.get_path = function() { return Test.SampleService._staticInstance._path; }
Test.SampleService.set_timeout = function(value) { Test.SampleService._staticInstance._timeout = value; }
Test.SampleService.get_timeout = function() { return Test.SampleService._staticInstance._timeout; }
Test.SampleService.set_defaultUserContext = function(value) { Test.SampleService._staticInstance._userContext = value; }
Test.SampleService.get_defaultUserContext = function() { return Test.SampleService._staticInstance._userContext; }
Test.SampleService.set_defaultSucceededCallback = function(value) { Test.SampleService._staticInstance._succeeded = value; }
Test.SampleService.get_defaultSucceededCallback = function() { return Test.SampleService._staticInstance._succeeded; }
Test.SampleService.set_defaultFailedCallback = function(value) { Test.SampleService._staticInstance._failed = value; }
Test.SampleService.get_defaultFailedCallback = function() { return Test.SampleService._staticInstance._failed; }
Test.SampleService.set_path("/ASPNET_AJAX_ServerControls/WebServices/SampleService.asmx");
Test.SampleService.HelloServer= function(onSuccess,onFailed,userContext) {Test.SampleService._staticInstance.HelloServer(onSuccess,onFailed,userContext); }
Test.SampleService.Search= function(prefixText,count,onSuccess,onFailed,userContext) {Test.SampleService._staticInstance.Search(prefixText,count,onSuccess,onFailed,userContext); }

Big difference.

About the only thing the same iin both s the first line. Note the use of the prototype pattern in the new proxy. While not only remaining consistent with the current library and associated patterns for constucting objects, this will be more important once Orcas is available and the improved debugging experience allows us to peer inside these proxies.

by Glav | with no comments
Filed under: , ,
AJAX Control toolkit and the latestASP.NET AJAX beta
Sunday, October 22, 2006 5:25 PM

I have been very quiet in the blogosphere lately. Lots of things have been keeping me busy, particularly some family related issues.

I haven't been completely technically stagnant though. I have been busy working with the Microsoft team on the AJAX Control toolkit, David Anson posted about the experience here. I have to say that having the privilege of working with this team has been absolutely fantastic. Its been a great insight into how Microsoft works and really educational in a great many ways.

Big Kudos to the Agility team (heaed up by Shawn Burke) that manages the AJAX Control toolkit for their latest release which was a monumental effort.

Well done guys.

by Glav | with no comments
Filed under: , ,
Wally does Devlink
Wednesday, October 11, 2006 12:47 AM

Update: I previously posted that this was Devlab, and it is infact Devlink. Wally pointed this out to me just this morning and apparently this post came not long after Wally's post so it looked like I was doing a double promo. I didn't realise he had posted just before me and I thought I was doing him a favour. Thats what you guess for just trying to be nice I guess..... and since I am not in the habit of removing posts, I am sure the blogging community will happily ignore my post anyway so I dont think its too drastic. If it is, then send your feedback to someonewhocares@limbo.com

 

Wally McClure is speaking at the DevLink conference that is on Friday Ocober 13 in nashville. The web site for the conference is http://www.devlink.net/. It is no cost for attendees. It will be a great opportunity to meet and network with other developers. Wally will be doing a talk on the Microsoft AJAX Libraries (formerly codenamed Atlas) and Sql Server CLR Objects in Sql server 2005. You will want to make time to attend this as there are many nationally recognized speakers that will be there.

If you need more Wally in your life (and he keeps telling me I do) and are anywhere near Nashville, now you can go can get more....

More Posts

This Blog

Syndication