Home
TeamSite
How to implement Checkin /out Asp.net
rajasekhar
Hello Everyone
Iam very new to worksite.
I would like to write a control using asp.net(c#), with basic operation like download,checkin/out.
I added a reference to Imanage.dll in ASP.net web application.
I wrote the following code for document checkout.
IManDocument imDoc;
Path="c:/temp" + filename;
imDoc=imDataBaseTemp.GetDocument(DocNum,Version);
imDoc.CheckOut(Path,IManage.imCheckOutOptions.imDontReplaceExistingFile,System.DateTime.Today.Date,comments);
The above code behaves well when i execute from the webserver, but when I try executing from the clients, it still tries checking out the file to a location ('Path') on the server,
How should i modify the Path variable so the it can point to client machine
from where the aspx page has been accessed.
Is it the correct way to implement the checkout operation??
Any general guidance with the above would be greatly appreciated. Thanks for taking the time to read this.
Many Thanks
Raja sekhar
Find more posts tagged with
Comments
dabird
Your C# code is executed on the server, not on the client, which explains why the document is checked out on the server and not on the client. What you need to do is push the file down to the client-side browser using the HttpResponse object. Here's a high-level algorithm of what should be happening:
1. Get the client-side checkout path and submit to the server. (You're already doing this.)
2. Check out the file using a temp path on the server. (You're already doing this.)
3. Update IManDocument.CheckoutPath with the client-side checkout path you received in step 1. (You need to implement this.)
4. Push the temp file you created in step 2 to the client-side browser using the HttpResponse object. (You need to implement this.)
NOTE: Sending the file to the browser will prompt the user to save the file, at which point the user could save the file to a path different than the one he specified for the checkout path. To circumvent this, you'd need some sort of ActiveX component in the client browser to intercept the file and save it to the checkout path the user specified. This is no small feat, however, and unfortunately it is beyond the scope of DevNet
For details on how to use the HttpResponse object to send a file to the client machine, review the .Net documentation supplied by Microsoft.