single binary

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?
 
H

Howard

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
 
K

Kevin Spencer

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.
 
V

Vadym Stetsyak

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
 
I

Ignacio Machin \( .NET/ C# MVP \)

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.
 
H

Howard

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top