Problem in Send Fax to local fax server

  • Thread starter Thread starter Mohammad Reza Ghabeli
  • Start date Start date
M

Mohammad Reza Ghabeli

I want to send fax with FAXCOMEXLib from the web application.In fax server
security only a special user has privilege to send fax & manage it's
documents. Then I want to impersonate special user to send fax from web
application .The source code is as follow :

============== In web config ==========
<identity impersonate="true" userName="MyUserName" password="MyPassword" />


============== In web application code behind ==========
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using FAXCOMEXLib;

public void RemoteFaxConnection()
{
try
{
FaxServerClass oFaxServerClass = new FaxServerClass();
oFaxServerClass.Connect("");

FAXCOMEXLib.FaxDocumentClass oFaxDoc = new FAXCOMEXLib.FaxDocumentClass();
oFaxDoc.Body = @"E:\2.TIF";
oFaxDoc.DocumentName = "Salam";
oFaxDoc.Recipients.Add("15" , "RecipientName");
oFaxDoc.ConnectedSubmit(oFaxServerClass);

oFaxServerClass.Disconnect();
}
catch(Exception Exc)
{
Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name +
"<BR>");
Response.Write(WindowsIdentity.GetCurrent().Name + "<BR>");
Response.Write(Exc.Message + "<BR>" + Exc.StackTrace);
}
}


The result of exceuting is "Access Denided" & Print the impersonate user
correctly .

Thanks for with best regards
Ghabeli
 
If you are using Windows 2003, try creating a new AppPool, setting it to run
under the identity of the fax user and setting your web app to use this pool
 
Back
Top