Functionality Not Available, please consult your system administrator

I have added custom entity, created "Documents" tab in its screen and added a "New" button on that "Documents" tab's screen. The code of adding button is the following (I'm using CRM 7.1 and I'm doing customization in CRM SDK):

string sURL = UrlDotNet().ToString();

AddUrlButton("New", "new.gif", Url("343") + "&Key-1=58&Key58=" + custom_entity_id + "&Libr_CompanyId=1000" + "&E=CUSTOM_ENTITY_NAME" + "&PrevCustomURL=" + sURL);

Clicking the "New" button opens the "New Document" page as expected. But when I click "Save" or "Cancel" on that page, CRM goes to a blank page and shows "Functionality Not Available, please consult your system administrator" message there (although, in the case of "Save" the record is added).

Can you please suggest, what is wrong in my code?

Regards,

Vardan