Hello in my aspx page using M开发者_Python百科VC 3, I have the following code:
<%Response.WriteFile("/Content/Bing.htm"); %>
Which is an include file that contains BING search box code.
At the top of the containing DIV, a strange character is appearing:

I realize it it probably a BOM Byte Order Marker, but for the life of me I cannot figure out why it is showing up and how to get rid of it. The rest of the bing code shows up and works fine.
Basically I want to be able to include htm files in my aspx pages.
any help would be appreciated. Thanks.
Presumably it's in the file. Edit the file in a binary file editor, and you should be able to see and remove it. Alternatively, read in the file in with something like File.ReadAllText
and then write out the string to the response. I'd expect that to strip the BOM - and have the additional benefit of using a consistent encoding in the response, even if you have files of different encodings. (You'd need to specify the encoding when reading them, of course.)
精彩评论