So I had a huge post ready to go about how to use ASP.Net Ajax createDelegate and createCallback functions together to get a function that will keep a property scoped this reference and pass predetermined arguments when I came across this article.  It is a great article about combining the functionally createDelegate and createCallback into a new function called createDelegateCallback.  This is a nice addition to the ASP.Net ajax library.

Posted at 11/12/2008 9:48 PM
Comments [0] - Permalink

While not exactly as soon as everyone hoped, dasBlog 2.0 is set to be released next Tuesday.  The biggest change is that dasBlog is now compiled under .NET 2.0 and ALMOST fully supports medium trust. The goal of medium trust is for hosting providers to provide functional ASP.NET 2.0 hosting while also protecting against rogue or malicious applications.  Unfortunately that protection comes at the cost of application flexibility. We tried our best but in the battle between security and functionally there are a few features that are limited in a medium trust environment:

  1. SMTP on alternative ports
    • This requires SmtpAccess.ConnectToUnrestrictedPort on the System.Net.Mail.SmtpPermission.  In a default medium trust environment you only get SmtpAccess.Connect, which allows for port 25 access but that's it.  I would assume that this is to prevent spamming and maybe to prevent using the SMTPClient class to launch socket based attacks.
  2. Mail to Weblog via POP3
    • This requires SocketPermission to at least the port and address of your pop3 server.  With the default medium trust settings you do not have any Socket Permissions.  This prevents applications from launching network based attack.  This is especially important if the web server is located behind a firewall because then an asp.net application could access network resources intended to be protected by the firewall.

dasBlog will let you know that you don't have these privileges by displaying warnings on the configuration page:

smtpCapture

pop3Capture

There is some good news though, these limitations won't affect most users.  Many hosting providers that run limited trust environments don't run in the default medium trust, but rather a "modified full trust".  In that case you may already have all the permissions you need for all of the features to work.  

If your hosting provider does run the standard medium trust configuration or their custom trust level doesn't provide the necessary permissions there is still hope. Normally hosting providers allow access to a mail server that runs on port 25.  In most cases it doesn't even matter if the from address dasBlog is using is hosted on that server, as long as you are authenticating with a valid SMTP user.  The POP3 issues is a bit more difficult.  There are legitimate reasons for a provider to limit socket access, but if you ask nicely they might make an exception for the specific POP3 host you are using.  

There is only last consideration that needs to be accounted for in a reduced trust environment.  You can read more details here, but the basic idea is that in the default medium trust environment you can only do outbound web connections that match your originURL.  OriginURL is specified as a regular expression in your web.config file.  Setting it to ".*" will let dasBlog connect to any host.

For more information about dasBlog check out http://www.dasblog.info, and if you are have any questions about medium trust or anything else feel free to post on the dasBlog forms at http://www.dasblog.us

 

 
Posted at 8/12/2007 12:11 AM
Comments [5] - Permalink

While working on a dasBlog bug report I found an interesting "feature" in ASP.Net 2.0.   There are a few controls on the configuration page that can be enabled on the client side via JavaScript.  This worked fine and dandy in asp.net 1.1 but in 2.0 it stopped working.  The controls that were enabled on the client side never had any value after postback (in this case it was a CheckboxList). 

After first thinking it had something to do with how dasBlog dynamically loads the configuration usercontrol dynamically it was time to dig into the toolbox for the trusty reflector.  It turns out that asp.net 2.0 won't load the postback data of a checkbox list (or a listbox or dropdownlist) if the control is not enabled. In asp.net 1.1 the control's postback data was always loaded.  Since the controls were being enabled on the client side and not on the server side the postback data was never loaded.

The easiest way to solve the problem is to enable the checkbox list before the postback data is loaded (OnInit or Page_Load).  If needed you can still disable the control later in the page lifecycle.

Posted at 7/16/2007 10:37 PM
Comments [2] - Permalink