Apr 16

AJAX request timeout error

The default value of AJAX postback is 90 seconds, so if you have a long asynchronous postback, you will get an error as this:

Sys.WebForms.PageRequestManagerTimeoutException: The server request timed out.

The fix is to change the default timeout value to a larger value in your ScriptManger’s AsyncPostBackTimeout property (10 minutes as below):

<asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="600">
        </asp:ScriptManager>
Apr 16

Invalid Parameter Binding error when using Oracle ODP.NET TableAdapter

If you use Oracle ODP.NET in Visual Studio 2010 (or earlier version) to create a DataTable by using TableAdapter wizard, you may get an Invalid Parameter Binding error if there is a parameter in your query. For example, this simple select query below can cause the error:

select * from Person where personId=:person_uid

The cause is strange because ODP.NET cannot recognize the parameter’s DbType and thus sets the DbType of the parameter to Object, so the fix is simple: just change the DbType from Object to Int32 or the correct DbType.

In Visual Studio, right click the query of the TableAdapter, then click Properties. From the Properties window, click Parameters drop down list, then change the DbType of the parameter from Object to Int32 (or the correct DbType in your application):

Oracle_Invalid_Parameter_Binding

After the change, the error will go away. However, if you ever change the query, you will need to remember to change the DbType again because ODP.NET will set it to Object again.

Apr 11

ASP.NET Forms Authentication Blocks Images and CSS Files

If you use the ASP.NET Forms Authentication in your web application that runs on IIS 7 or above with the integrated pipeline application pool, you may find that the images and the styles of your application are not displayed until you are logged in (authenticated). If you encounter this problem, here is the solution to fix it.

First, let me take one step back to explain why the problem happens. If you look at your web.config file, you will most likely see a property in the <modules> section as follows:

<modules runAllManagedModulesForAllRequests="true" />

If you have implemented the Forms Authentication in your application, this line of code, when is set to true, tells ASP.NET to protect all contents in your application, including the images and css files from all unauthenticated users. So if you have images and styles on your login page, then they will not display. This is new in IIS 7 and above. To ensure the backwards compatibility, IIS 7 and above uses a precondition for the default configuration for all managed modules. So, by default, ASP.NET should only protect requests handled by a managed handler, such as .aspx or .asmx files, because of the precondition. However, the above line in the web.config when set to true will ignore the precondition, and thus all requests are handled by the managed handler.

Based on the information, the quick and dirty fix will be set the above line to false or simply remove the line from your web.config.

<modules runAllManagedModulesForAllRequests="false" />

But what if your web application requires high security and you DO need to protect files other than .aspx and .asmx files? So the better solution will be set the above line to true, and at the same time to use <location> for your image files and css files to bypass the authentication.

<location path="Styles">
    <system.web>
      <authorization>
        <allow users="?"/>
      </authorization>
    </system.web>
  </location>
  <location path="App_Themes">
    <system.web>
      <authorization>
        <allow users="?"/>
      </authorization>
    </system.web>
</location>

However, there is one more problem with the solution above. If your site has heavy traffic,

runAllManagedModulesForAllRequests="true" will force all requests to be handled by managed modules which will increase the load of your application, besides, you may only need some managed modules to handle all requests regardless of content, but for other modules, they can use the default configuration to handle the request. To do this, you will need to identify what modules should handle all requests regardless of content, for instance, the Forms Authentication Module and the URL Authorization Module; then modify the <module> property of your web.config file as follows:

  <system.webServer>
    <!--<modules runAllManagedModulesForAllRequests="false" />-->
    <modules>
      <remove name="FormsAuthenticationModule" />
      <add name="FormsAuthenticationModule"
           type="System.Web.Security.FormsAuthenticationModule" />

      <remove name="UrlAuthorization" />
      <add name="UrlAuthorization"
           type="System.Web.Security.UrlAuthorizationModule" />

      <remove name="DefaultAuthentication" />
      <add name="DefaultAuthentication"
           type="System.Web.Security.DefaultAuthenticationModule" />
    </modules>
  </system.webServer>

This change combined with the <location> tag will allow ASP.NET to display the images and the style on your page, without causing security issues.

Hope this helps.

References:

Feb 21

New Windows 8 logo

In case you don’t know, the upcoming Windows 8 will have a new logo:

1537.Win8Logo_01_008485DD

Honestly, I am very disappointed with the design of the new logo because it is too simple and too clean, and it looks like a flag of a country: if you replace blue with white, and white with dark blue, it becomes the flag of Finland.

I hope it will be changed when Windows 8 is released.

For more information about the new logo, check Blogging Windows.

Feb 14

Illegal characters in path error

I am working on a project allows user to upload files to server and download uploaded files from server. It is simple and straight-forward: the file is save in file system, and the file path is saved in database. When user requests to download a file, the file path is returned from the database and user is prompted with the save file dialog to save the file. Everything has been working well, then suddenly one day the application threw a System.ArgumentException error saying “Illegal characters in path”. I checked the file system but didn’t find any illegal characters in any file names, so the problem is not in the file system. After more investigation, I found out the problem lies in the file path stored in database.

The data type for the file path column in database is varchar and doesn’t support Unicode text, so when a file that containing Unicode text in the file name is uploaded, the Unicode text becomes questions marks (?????), and when this file is requested for download, the question marks will cause the “Illegal characters in path” error. The fix is simple: change the data type from varchar to nvarchar to support Unicode text.

Jan 17

Features I enjoy in SugarSync

I have been with SugarSync for almost a year now. I started with the 5 GB free plan and today I decided to upgrade my free plan to a paid plan. Why? Because I love SugarSync and I want to support it to stay strong in business so I can continue enjoying the service it provides.

If you are looking for cloud storage with generous space, I suggest you to take a look at SugarSync. If you are currently using DropBox, or SpiderOak, I suggest you to read my previous post for the comparison of these three providers.

Today, I am going to share with you some features that I like in SugarSync:

1. Upload by Email

This is so far my favorite feature. Once you sign up with SugarSync, you will automatically get an special email address like YourUsername.AGeneratedNumber@e2f.sugarsync.com, it is your Upload by Email address. If you send an email with attachment to this address, your attachment will be automatically uploaded to your SugarSync account and synced across your computers. To locate your Upload by Email address, first login to your SugarSync account, then click Account tab on the top, you will see your Upload by Email address under the Settings section. What if this email address is compromised by spammers? No worry, you can login and regenerate a new Upload by Email address.

2. SugarSync for Outlook

SugarSync plugin for Outlook allows user to send large attachment via SugarSync instead of the email attachment. The large attachment is uploaded and stored in the cloud in a folder called “Uploaded by Outlook” in your Web Archive, and the recipients will just need to click a link included in their email message to download the attachment. No need to worry about the size limit of the email attachment and also the uploaded attachment is backed up in the cloud.

3. Flexibility of File Sync and Sharing

After you install SugarSync client, a folder called Magic Briefcase will be created. Any file and folder in this folder will be automatically synced across your computers running SugarSync client. However, you can also choose any other folder on your computer to sync with any computer of yours without having to put them in Magic Briefcase. It is very useful if you just want to sync some file or folder with some specific computer, but not all computers.

SugarSync’s Magic Briefcase folder is similar to DropBox’s My DropBox folder. DropBox uses My DropBox folder for everything, including files you shared with other people and files other people shared with you, and the problem is the file sharing and sync will get confusing when you have a lot of files and folders. The shared file/folder will be synced across computer automatically, and you don’t have control over it. SugarSync, however, creates a folder called SugarSync Shared Folder when someone shared a file with you, and you can decide the destination where the shared file will reside. In my opinion, a separate folder for file sharing makes it easier to organize your files.

4. Generous Storage Space

SugarSync offers a free plan with 5 GB space for you to start with and offers some options to give you some bonus free space up to 1 GB. After you download and install SugarSync, login to your account, then click Getting Started on the top of the page, then complete those six tasks to earn up to 750 MB free space:

SugarSyncTasks

If you have iPhone, then you can install SugarSync for iPhone, then play a simple game in SugarSync for iPhone to earn additional 250 MB free space. So now you have 6 GB total free space. If you want to earn more free space, you can use SugarSync’s referral program to earn UNLIMITED free space.

There are a lot more features in SugarSync that I didn’t cover here, and the above features are those I like the most. You can check their web site to get a full list of features.

I hope you find this post and my previous post helpful. Should you have decided to choose SugarSync, could you use my referral link to sign up? If you use it to sign up a free 5GB account and install the client, you will get an extra 500 MB bonus space, and I will get a 500 MB bonus as the result of the referral. Thank you in advance.

https://www.sugarsync.com/referral?rf=e3izqm2hfvy70&utm_source=txemail&utm_medium=email&utm_campaign=referral

Happy Syncing!

Dec 21

Keep your SugarSync referral link on your own site

Since I published my latest post titled “SugarSync vs DropBox vs SpiderOak, which should I choose”, several people have tried to post their SugarSync referral link in their comments on my post. I find it very annoying, so I would like to make it clear: please don’t post your SugarSync referral link on my site. If you want to earn bonus space by referring people, then post your referral link on your own site.

Anyone who posts their referral link from SugarSync, DropBox, SpiderOak, or whatever, is not welcome here, and the post will be deleted immediately.

Dec 19

CSI Miami web page messed up

I am a big fan of CSI: Miami show from CBS and will watch the show on-line if I miss an episode. This morning when I opened their web site to see if the latest episode has been uploaded, to my surprise, I found that CSI: Miami show’s web site was messed up with The Good Wife show’s web site. Take a look the screen shot below:

CSI_Miami_TheGoodWife

When I clicked Watch Now button, I was taken to The Good Wife show web site.

Maybe the web master of CBS.com had a rough weekend?

Dec 09

SugarSync vs DropBox vs SpiderOak, which should I choose?

I wrote a post in April regarding the pros and cons of several cloud storage/backup service providers based on my experience, such as Windows Live Mesh, DropBox, Memopal, SpiderOak, and SugarSync, and I concluded that SugarSync is better than the others. Then you may ask what is the purpose of this post?

Well, it seems that many people are not happy with SugarSync because it does not have a native Linux client, so those people, especially Linux users, left SugarSync and chose either DropBox or SpiderOak. What I want to do here is to give a summary of the feature comparisons of the three service providers.

1. Backup

All three provide backup with recovery feature, but DropBox only backs up files in My DropBox folder on your computer. Both SugarSync and SpiderOak allow you to choose any folder on your computer to back up.

2. Sync with multiple computers

All three allow file/folder synchronization among multiple computers running their clients, but DropBox can only sync files/folders in My Dropbox on your computer. Both SugarSync and SpiderOak allow you to choose any file/folder on your computer to sync with another computer.

3. Easy to use

DropBox is very easy to set up and use. The installation process is simple and it will create a folder on your computer called My DropBox, and all files and folders will be synced automatically with other computers running the DropBox client.

SugarSync is also easy to set up and use. The installation process is simple and will create a folder called Magic Briefcase. Like DropBox’s My Dropbox folder, any files/folders in Magic Briefcase will be synced automatically with other computers running the SugarSycn client.The client also allows you to choose any folder or file on one computer to sync to another computer.

SpiderOak is not very easy to use. The installation process is simple and easy to follow, but it takes quite some time to understand  and to use the sync process. It does NOT create any folder for you, and it is up to you to choose which folder/file to sync.

4. Remote access

All three provide remote access to your files stored on their servers.

5. Security

All three provide encryption on your files that stored on their server, however, both SugarSync and DropBox claim that they have the ability to decrypt your files when needed for the legal purpose, because the decryption key of your files is stored on their servers too. SpiderOak, however, prevents anyone except you to decrypt your file, because the decryption key is not stored on their server, instead, the key is stored on your local computer when you install the client. If you are concerned about your privacy and don’t want ANYONE except you to be able to access your files, then you have two options:

1). Encrypt your files before you upload to their server

2). Use SpiderOak

If you choose SpiderOak, then you need to remember the risk: if you ever forget your password, then you will not be able to access your files any more, because your password is created locally and is not stored on their server, and there is no password recovery feature. Then you may ask, what if I forget my password? Here is the answer from SpiderOak:

Q #13: What if I forget my SpiderOak password?

At the time when you create your SpiderOak password, you will also be prompted to create a password hint. The creation of a password hint is not mandatory however it will be your only clue should you forget your password. If you choose to create a password hint, we advise you to create one that is informative enough so that you will remember but not too obvious so that anyone may guess. The password hint may be recovered anytime on the SpiderOak web page.

At SpiderOak we have created a true 'zero-knowledge environment' meaning that no one including the SpiderOak employees will ever know what you are storing on your SpiderOak Network. We can maintain this environment because at no time will anybody know your password (or the answer to your password hint) except you.

So I guess the zero-knowledge privacy comes with a price.

6. File sharing

All three allow file sharing, but the file sharing feature in DropBox is limited. You can only share files/folders in My DropBox folder, and all shared files from other people will be placed in your My DropBox folder. Both SugarSync and SpiderOak allow you to choose any file/folder on your computer to share with other people. The good thing about SugarSync sharing is that if another SugarSync user shared a file with you, then when you accepted the shared file, a folder called SugarSync Shared Folder will be created under My Documents (or Documents in Windiws Vista/7), and then a sub folder named after the user’s name will also be created to better organize files.

SpiderOak, however, is very hard to use to share files/folders. For instance, you will need to create ShareID and RoomKey before you can start sharing something, it is not easy I warn you.

7. Cross platform

All three support Windows and Mac platforms, but SugarSync is the only one that does not support Linux platform at this moment, I hope they will have a Linux client soon.

8. Mobile

SugarSync supports more mobile devices than the other two:

SugarSync: iPad, iPhone, BlackBerry, Windows Mobile, Android, Symbian.

DropBox: iPad, iPhone, BlackBerry, Android.

SpiderOak: iPad, iPhone, Android, N900 Maemo

9. Storage and subscription

SugarSync provides 5 GB free storage plus 500 MB bonus for each account sign up referred by you (no limit). It also provides paid plans if you need more space and more features.

DropBox 2 GB free storage plus 250 MB bonus for each account sign up referred by you (no limit). It also provides paid plans.

SpiderOak provides 2 GB free storage plus free bonus storage for each account sigh up referred by you (up to 50 GB). It also provides paid plans.

10. Upload / Sync via Email

Only SugarSync provides this nice feature. After you login your SugarSync account, click Account tab on the top, you will see your Upload by Email address under the Settings section:

SugarSyncUploadByEmail

 

 

If you send an email with an attachment to your Upload by Email address @e2f.sugarsync.com, then the attachment will be automatically uploaded to your SugarSync account and synced across your computers. You will find a new folder called Uploaded by Email is created under Magic Briefcase. I really like this feature because I can give my customer my Upload by Email address, and when they send attachments to that address, I will get them on any of my synced computer.

I hope you find this post and my previous post helpful. Should you have decided to choose SugarSync, could you use my referral link to sign up? If you use it to sign up an free 5GB account, you will get an extra 500 MB bonus space, and I will get a 500 MB bonus as the result of the referral. Thank you in advance.

https://www.sugarsync.com/referral?rf=e3izqm2hfvy70&utm_source=txemail&utm_medium=email&utm_campaign=referral

Happy Syncing!