TWAIN ActiveX Control, Plug-in, Scanner SDK, Component, HTTP Control/SDK

Dynamsoft TWAIN Products

Support Community for TWAIN Control/Component/SDK for Scanning Solutions
* Login   * Register
* FAQ    * Search

It is currently Sun May 20, 2012 3:07 pm




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: HTTP Process error.
PostPosted: Tue Apr 18, 2006 10:33 pm 
Offline

Joined: Tue Apr 18, 2006 10:09 pm
Posts: 1
Location: Bangalore
Hi Catherine,

We are using the Licensed version of DynamicWebTwain Active X control in our webserver. It works well in our local environment, but when we repeated the same steps on the QA Webserver, it is giving always HTTP process error.

HTTPUploadThroughPost(strHostIP,0,strActionPage,"SampleID.JPG");

We are reading the HostIP from the web.config file ( we have tried by giving machine name and both physical IP address), the Action page path is the relative path like ("/Georgia/Module/Sample/SaveToFile.aspx"). The SaveToFile.cs contents are as follows in the page_load event:



HttpFileCollection files = HttpContext.Current.Request.Files;
HttpPostedFile uploadfile = files["RemoteFile"];
string strpath=UTL.WebAppConfig.ImageSavingPath;
int fileLength=uploadfile.ContentLength;
bool returnType=false;
if(fileLength!=0)
{
string fileName = string.Empty;
string fileType = string.Empty;
string[] fileParts;
string strSampleID;
fileName = uploadfile.FileName;
fileName = System.IO.Path.GetFileName(fileName);
fileParts = fileName.Split('.');
fileType = fileParts[fileParts.Length-1].ToUpper().Trim();
strSampleID=fileParts[0].ToUpper().Trim();

uploadfile.SaveAs (strpath + fileName);
string username=String.Empty;
if(Session["ScanUsername"]!=null)
{
username=Session["ScanUsername"].ToString();
}
objSamplesRegisterModify.SaveImagePath(fileName,strSampleID.ToString().Trim(),username); // this line of code is specific to project which stores the image path in the database.
}


Pls help us in providing a solution.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 12:49 am 
Offline
User avatar

Joined: Tue Mar 08, 2005 12:23 am
Posts: 1075
Please check the security of the server directory where the images are uploaded first. Make sure the ASP.NET Machine Account has read/write access to this directory.

If this is not the issue, would you please let us know the response string from the HTTP server (you can check the HTTPPostResponseString property)?

Thanks.

_________________
Catherine Sea
TWAIN Support Team
TWAIN ActiveX/Plug-in for Web Applications, Scanner COM Control
TWAIN .NET Component/SDK for Desktop Applications

Follow me @Twitter, Facebook
Image


Top
 Profile  
 
 Post subject: HTTP Process error
PostPosted: Wed May 03, 2006 10:18 pm 
Offline

Joined: Tue Apr 18, 2006 10:09 pm
Posts: 5
Hi Catherine/Robert,

I am getting HTTP Process error when I used HTTPUploadAllThroughPostAsMultiPageTIFF method to upload the scanned documents to the server. It is returning a non zero error code but uploads successfully to the server if we ignore the errors in the dev environment (which is not secure). I am setting the HttpPort property to 80 in the dev and 443 in the QA.

Same code is not uploading the documents to the server in the secured QA environment even after ignoring the errors.

Below is the code I used for uploading:


function Save()
{
if(frmScan.WebTwain1.HowManyImagesInBuffer == 0)
{
alert("Please Scan and then click Save button");
}
else
{
var strActionPage;
var strHostIP;

var CurrentPathName = unescape(location.pathname); // get current PathName in plain ASCII
var CurrentPath = CurrentPathName.substring(0, CurrentPathName.lastIndexOf("/") + 1);
var actionpage = "<%=pagename%>" + "&docname=<%=docname%>";
strActionPage = CurrentPath + actionpage; //the ActionPage's file path
strHostIP = "<%=servername%>"; //"<%=servername%>";"localhost" //the host's ip or name
//strHostIP = "localhost"; //the host's ip or name

frmScan.WebTwain1.HTTPPort = <%=portnum%>;
frmScan.WebTwain1.HTTPUploadAllThroughPostAsMultiPageTIFF(strHostIP, strActionPage,"");
//frmScan.WebTwain1.HTTPUploadThroughPost(strHostIP,0,strActionPage,justfilename);


/*if (frmScan.WebTwain1.ErrorCode != 0)
{
alert(frmScan.WebTwain1.ErrorString);
alert(frmScan.WebTwain1.HTTPPostResponseString);

}
else
{*/
alert("uploaded");
document.forms[0].submit();
doSubmit(1);
//}
}


}

Below is the Response String I got:

I am not able to load the image here. But I have sent an email to TWAINSupport@dynamsoft.com with the response string image.


Below is the code I used in the page load event handler of aspx.cs file:


if(utils.IsSecure())
portnum = "443";
else
portnum = "80";


servername = utils.GetUrlBase(this.Context.Request.Url);
servername = servername.Substring(servername.IndexOf("://")+3);
pagename = "UploadScanDoc.aspx?&user_id=" + enc_userid; //+ "&docname=" + docname;
sessionid = this.Context.Session.SessionID + "_";


if(filingid == "" && Request["filingid"] != null && Request["filingid"] != "")
{
filingid = Request["filingid"].ToString();
docname = sessionid+filingid+".tif";
}


//set docpath
string orgdocstoredpath = "";
string pdfstoredpath = "";
string dummy_filename = "";
string pdfilename = "";
string dummy = "";
string datepath = "";
FilingEdit.getPermanentPaths(ref dummy_filename, out pdfilename, out datepath, out orgdocstoredpath, out pdfstoredpath, out dummy, out dummy);
//upload the doc
docpath = orgdocstoredpath + datepath;
docpath += "\\";

if(Session["UploadedScanDoc"] == null || Session["UploadedScanDoc"].ToString() == "")
{
Session["UploadedScanDoc"] = docpath+docname;
}


Below is the code we used for the Action Page -> UploadScanDoc.aspx.cs:

if(userid.Length > 0 && Request.ContentLength > 0)
{
long UserID = long.Parse(userid);
theUser = new User(UserID);

if(theUser != null && (theUser.GroupID == 2 || theUser.GroupID == 3))
{
if(Request["docname"] != null && Request["docname"] != "")
{
string docName = Request["docname"].ToString();
string orgdocstoredpath = "";
string pdfstoredpath = "";
string filename = "";
string pdfilename = "";
string dummy = "";
string datepath = "";
FilingEdit.getPermanentPaths(ref filename, out pdfilename, out datepath, out orgdocstoredpath, out pdfstoredpath, out dummy, out dummy);
System.IO.Directory.CreateDirectory(orgdocstoredpath + datepath);
//upload the doc
string absolutePath = orgdocstoredpath + datepath + "\\" + docName;

HttpFileCollection files = HttpContext.Current.Request.Files;
if(files != null)
{
HttpPostedFile uploadfile = files["RemoteFile"];

if(uploadfile != null)
{
//uploadfile.SaveAs(absolutePath);
int bufferSize = 4096;
Stream readStream = uploadfile.InputStream;

FileInfo f = new FileInfo(absolutePath);
FileStream writeStream = f.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite);

byte[] buffer = new byte[bufferSize];
int count = 0;
int offset = 0;
while( (count = readStream.Read( buffer, offset, buffer.Length ) ) > 0 )
{
writeStream.Write(buffer,offset,count);
}
readStream.Close();
writeStream.Close();

}
else
{
System.Diagnostics.EventLog.WriteEntry("ScanUpload","No upload file obj");
}
}
}
}


Please let us know the solution.
This is the important fix to be made. So please let us know as soon as possible.

Thanks,
Nagasree.
[/img]


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 12:12 am 
Offline
User avatar

Joined: Mon Mar 07, 2005 11:11 pm
Posts: 866
Nagasree, please refer to our reply to another post of yours at:

http://www.dynamsoft.com/forum/viewtopic.php?t=422

_________________
Robert
TWAIN Support Team
http://www.dynamsoft.com/
TWAIN ActiveX/Plug-in HTTP Control/SDK & TWAIN ActiveX Control, Scanner SDK, Component
Software Configuration Management | SCM Solution


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

It is currently Sun May 20, 2012 3:07 pm


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Copyright © 2010 Dynamsoft Corporation. All Rights Reserved. | Knowledge Base | Source Control Blog