VCF文件创建问题 [英] VCF file creation issue

查看:72
本文介绍了VCF文件创建问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建vcf文件。它正在创建具有相应数据的vcf文件但是当在记事本中打开vcf文件时,我发现一些错误被记录到文件中。



错误是

[HttpException(0x80004005):服务器无法在发送HTTP标头后设置内容类型。]

[HttpException(0x80004005):执行处理程序'System.Web.Mvc的子请求时出错.HttpHandlerUtil + ServerExecuteHttpHandlerWrapper'。]



我的源代码是:



Dim sw作为新的StringBuilder( )

sw.AppendLine(BEGIN:VCARD)

sw.AppendLine(VERSION:3.0)

sw.AppendLine( N:+ strlastName +;+ strfirstName +;;;)

sw.AppendLine(FN:+ strfirstName ++ strlastName)

sw.AppendLine(ORG:+买家保护组)

sw.AppendLine(EMAIL; TYPE = work:+ s trEmail)

sw.AppendLine(TITLE:+ JobTitle)



If(Not String.IsNullOrEmpty(strMbNumber))然后

sw.AppendLine(TEL; WORK; VOICE:+ strMbNumber)

结束如果

sw.AppendLine(END:VCARD)

Dim FileName As String =vCard.vcf

Response.Clear()

Response.ContentType =text / x-vcard

Response.AddHeader(content-disposition,inline; filename =&FileName

Response.Write(sw.ToString())

Response.Flush()



原因可能是什么。请帮助我。

I am trying to create vcf file. It is creating the vcf file with respective data but when one opening the vcf file in notepad then i found some error is logged into file.

The Error is
[HttpException (0x80004005): Server cannot set content type after HTTP headers have been sent.]
[HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'.]

My source code is:

Dim sw As New StringBuilder()
sw.AppendLine("BEGIN:VCARD")
sw.AppendLine("VERSION:3.0")
sw.AppendLine("N:" + strlastName + ";" + strfirstName + ";;;")
sw.AppendLine("FN:" + strfirstName + " " + strlastName)
sw.AppendLine("ORG:" + "Buyers Protection Group")
sw.AppendLine("EMAIL;TYPE=work:" + strEmail)
sw.AppendLine("TITLE:" + JobTitle)

If (Not String.IsNullOrEmpty(strMbNumber)) Then
sw.AppendLine("TEL;WORK;VOICE:" + strMbNumber)
End If
sw.AppendLine("END:VCARD")
Dim FileName As String = "vCard.vcf"
Response.Clear()
Response.ContentType = "text/x-vcard"
Response.AddHeader("content-disposition", "inline; filename=" & FileName)
Response.Write(sw.ToString())
Response.Flush()

What could be the reason. Please help me out.

推荐答案

这篇关于VCF文件创建问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆