G
Guest
Hi all,
This is partially a .NET question and partially scripting (whichever works
I recently wrote a vCard parser that sends vCards directly to the brower as a stream. After the file is transmitted I need to close the window, but I can't get anything to works because I’m ‘hijacking’ the Response.Write method.
Here is a small snippet of the code:
string strDN = "CN=Brigit Runge,OU=TestUsers,DC=engineering,DC=somewhere,DC=com";
DirectoryEntry deUser = new DirectoryEntry("LDAP://server/" + strDN);
string strCN = deUser.Properties["cn"].Value.ToString();
string strvCard = BuildvCard(deUser);
Response.AddHeader("content-disposition", string.Format("attachement; filename={0}.vcf", strCN));
Response.ContentType = "text/x-vcard";
Response.Write(strvCard);
Response.Write("<script>self.close();</script>");
//Response.End();
I've tried a number of script attempts, from onClick to onBlur. Any successful window closing prohibits the actual file transfer. I could use a timer, but I want to make sure the file actually gets sent.
Any ideas?
Thanks,
Bill
This is partially a .NET question and partially scripting (whichever works
I recently wrote a vCard parser that sends vCards directly to the brower as a stream. After the file is transmitted I need to close the window, but I can't get anything to works because I’m ‘hijacking’ the Response.Write method.
Here is a small snippet of the code:
string strDN = "CN=Brigit Runge,OU=TestUsers,DC=engineering,DC=somewhere,DC=com";
DirectoryEntry deUser = new DirectoryEntry("LDAP://server/" + strDN);
string strCN = deUser.Properties["cn"].Value.ToString();
string strvCard = BuildvCard(deUser);
Response.AddHeader("content-disposition", string.Format("attachement; filename={0}.vcf", strCN));
Response.ContentType = "text/x-vcard";
Response.Write(strvCard);
Response.Write("<script>self.close();</script>");
//Response.End();
I've tried a number of script attempts, from onClick to onBlur. Any successful window closing prohibits the actual file transfer. I could use a timer, but I want to make sure the file actually gets sent.
Any ideas?
Thanks,
Bill