single binary

  • Thread starter Thread starter Howard
  • Start date Start date
H

Howard

How do I hardcode config properties in my binary?
I would like to put this app.config into my c# source code

<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true"/>
</settings>
</system.net>
</configuration>

Is this possible?
 
Im not using any COM dlls, all .NET

just hardcode the app.config settings in my source code.

there has to be a way...scratch head
 
You can certainly declare a public or static class member that is a boolean,
and use that when you create a WebRequest in your class. However, what I
think is confusing you is that a config file is an XML text file, which
represents data. That same data, in a binary, would not be encoded as XML,
which is used for text representation of data.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.
 
Hello, Kevin!

KS> You can certainly declare a public or static class member that is a
KS> boolean, and use that when you create a WebRequest in your class.
KS> However, what I think is confusing you is that a config file is an XML
KS> text file, which represents data. That same data, in a binary, would
KS> not be encoded as XML, which is used for text representation of data.

IMO OP here meant that he wants do the same setup actions ( that are stated in config ), but without actually using config file - that is using some kind of API.
Setup action here will be setting flag, that will influence HTTP data parsing process ( useUnsafeHeaderParsing ).

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Hi,

You can include any file you want in your binary, the problem in this case
is that you cannot use the default framework config class. You will have to
implement your own.

IIRC there is one Config class just like that as part of the opennetcf.org
framework, download it and use the class, but instead of reading a file you
read it from a file you read it from the resources.
 
how do I implement this code??
where should I make the call from? in program main?

sorry, but im a little confused. i thought it would be something like this

system.net.configureation.httpwebrequest.useUnsafeHeaderParsing = true;
 
Back
Top