Wednesday, January 28, 2004


How to keep encrypted passwords (in the database)

How To: Use Forms Authentication with SQL Server 2000

Key ideas:
using System.Security.Cryptography;
using System.Web.Security;

Hash, Salt

Wednesday, January 21, 2004


FACSys logon problem


I'm working on integration of our ASP.NET application and Fax Server.
I use Interop.FXMSG32.dll for that.

The problem is that I cannot login to server from my application.
I get error message during attempt to login:
"System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80041006."
In this line:
oSession.Logon(FaxIP, FaxLogin, FaxPassword);
At the same time "FACSys desktop" can successfully connect from my computer to our FaxServer.


The logon error you are getting means that the fax manager service is not accessible. Possible causes are that the service is not started (not
likely) or the service does not accept the connection.
Unless you specified how to connect to the server, it will try to use Windows Networking, and this does not work if the FACSys server and the client (your application) are not in the same windows domain or in domains that trust each other. Please try to set the connection type to TCP/IP with something like: oSession.NetworkProtocol = 2 oSession.NetworkPortNumber = 2514 before the line oSession.Logon(FaxIP, FaxLogin, FaxPassword)

Also, on the FACSys server, it might help to set the Optus Fax Device Manager to run as an account that has administrative privileges at least on the local machine.

It might be a good idea to install the FACSys Desktop client on the machine where you run your application. The Desktop client uses the same library to communicate to the FACSys server and pretty much everything the client does can be done from an AFMSDK application, except local rendering (AFMSDK always renders attachments on the server).

Liviu Toma

Contact Phone: 1-866-436-3278 Ext. 31


I (Dennis Gorelik) added two lines of code, so result code is:
oSession.NetworkProtocol = 2;
oSession.NetworkPortNumber = 2514;
oSession.Logon(FaxIP, FaxLogin, FaxPassword);

This code works successfully: fax page was successfully created in the "Outbox" fax queue on FaxServer.

Monday, January 19, 2004


Asynchronous call of Web Services

User enters input data on a web page and clicks a button "Process".
Web page shows message "Your data is processed...".
Then web page run web service which process the user's data.
User continues to work on the web page.
After some time (20 seconds for instance), the web service returns the result.
Web page puts the result in front of user.
With all this going on the web page isn't reloaded.

How to implement all of this?
WebService behavior

Monday, January 05, 2004


How to specify page size and paper orientation for PDF document in Crystal Reports ASP.NET

Crystal Reports: how to specify page size and paper orientation for PDF document


When developer asks Crystal Reports to print a document, Crystal Reports behaves in strange way: It selects one of the installed printers and starts to consider this printer as "default printer" (in spite that the printer is not a default printer).
As a result:
1) "oRpt.PrintToPrinter(,,,)" method by default prints to this "self-selected" printer.
2) "oRpt.Export()" method (which prepares PDF document from the Crystal Report) define page size in correspondence with settings of the "self-selected" printer.

What is "self-selected" printer: it is a printer which is installed in Windows, but not necessarily is specified in your Crystal Reports document.

In my case, all PDF documents were formatted by size of my "SATO Label Printer" (4 inches width (height)). In spite that I explicitly defined standard Laser Printer for my Crystal Report document.
Obviously this is a Crystal Report bug.

Solution: first step

In Crystal Reports designer set:
"Right mouse click" on report -> Designer -> Printer Setup -> Check "No printer".
"No printer" should be checked after report design is completed. It is important, because some fields could become unavailable after specifying "No printer".

"No printer" will allow to get rid of "self-selected" printer bug.
By default, standard "A4" paper with portrait orientation will be used.
In most cases this is a solution. But what if you want to use non-A4-size paper or want to print with "Landscape" orientation?
Let's see "second step" of the solution.

Solution: second step

Before you call "oRpt.Export()" --- explicitly specify printer's name, Paper orientation, and Paper size.
Use piece of my code as example:
oRpt.PrintOptions.PrinterName = @"\\FAXSERVER\GEN6FAXPR";
oRpt.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
oRpt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter;
//oRpt.PrintToPrinter(1, false,0,0);
oRpt.Export(); // C:\Inetpub\wwwroot\Reports\ExportedReports should exist!
Note: This code will work only if you checked "No printer" checkbox in Crystal Report designer (see: "Solution: first step" above).

How I found solution:

My colleague gave me "first step" of the solution (about "no printer" checkbox).
It worked until I tried to prind "Landscape" document.
Then I spend half a day on Google and found this article:
landscape problems - preview vs. print (.NET)

Not everything in this article is up-to-date, but the article definitely has good idea: to specify Crystal Reports printing parameters explicitly.
So, I made this experiment and succeeded.

This page is powered by Blogger. Isn't yours?