By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,994 Members | 1,080 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,994 IT Pros & Developers. It's quick & easy.

single binary

P: n/a
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?
Apr 5 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Hello, Howard!

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

You can do that without config file.
Take a look at
( http://forums.microsoft.com/MSDN/Sho...96969&SiteID=1 )

However, this way uses undocummented stuff that can change in the future.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Apr 5 '06 #2

P: n/a
wow i didn't think it would be this complicated.

thanks ill try it out.
"Vadym Stetsyak" <va*****@ukr.net> wrote in message
news:Os**************@TK2MSFTNGP05.phx.gbl...
Hello, Howard!

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

You can do that without config file.
Take a look at
( http://forums.microsoft.com/MSDN/Sho...96969&SiteID=1 )

However, this way uses undocummented stuff that can change in the future.

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

Apr 5 '06 #3

P: n/a
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
"Vadym Stetsyak" <va*****@ukr.net> wrote in message
news:Os**************@TK2MSFTNGP05.phx.gbl...
Hello, Howard!

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

You can do that without config file.
Take a look at
( http://forums.microsoft.com/MSDN/Sho...96969&SiteID=1 )

However, this way uses undocummented stuff that can change in the future.

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

Apr 5 '06 #4

P: n/a
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.

"Howard" <ho*******@yahoo.com> wrote in message
news:uP**************@TK2MSFTNGP05.phx.gbl...
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?

Apr 5 '06 #5

P: n/a
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
Apr 5 '06 #6

P: n/a
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.

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Howard" <ho*******@yahoo.com> wrote in message
news:uP**************@TK2MSFTNGP05.phx.gbl...
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?

Apr 5 '06 #7

P: n/a
Yes, this can be done. See:

http://forums.microsoft.com/MSDN/Sho...96969&SiteID=1

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

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

"Vadym Stetsyak" <va*****@ukr.net> wrote in message
news:OZ**************@TK2MSFTNGP02.phx.gbl...
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

Apr 5 '06 #8

P: n/a
Hello, Kevin!

KS> http://forums.microsoft.com/MSDN/Sho...96969&SiteID=1

:8-)) Thats the same link I've alread posted.

IMO based on the link we can say that we're not using config in the file form.
Yes, we access classes that use that config, but we do not have to supply config file - its all in code...

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Apr 5 '06 #9

P: n/a
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.useUnsafe HeaderParsing = true;
"Vadym Stetsyak" <va*****@ukr.net> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Hello, Kevin!

KS> http://forums.microsoft.com/MSDN/Sho...96969&SiteID=1

:8-)) Thats the same link I've alread posted.

IMO based on the link we can say that we're not using config in the file
form.
Yes, we access classes that use that config, but we do not have to supply
config file - its all in code...

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

Apr 5 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.