Salut @ tous,
J'aurais besoin d'envoyer un formulaire en méthode post à partir du
serveur
web (pour éviter que l'internaute ne puisse voir le contenu de certains
champs).
Est-ce possible ?
Je ne vois pas comment fabriquer le formulaire et son contenu en mémoire
mais j'ai le présentiment qu'il doit-y avoir une solution...
D'avance merci
@+
Laurent
Salut @ tous,
J'aurais besoin d'envoyer un formulaire en méthode post à partir du
serveur
web (pour éviter que l'internaute ne puisse voir le contenu de certains
champs).
Est-ce possible ?
Je ne vois pas comment fabriquer le formulaire et son contenu en mémoire
mais j'ai le présentiment qu'il doit-y avoir une solution...
D'avance merci
@+
Laurent
Salut @ tous,
J'aurais besoin d'envoyer un formulaire en méthode post à partir du
serveur
web (pour éviter que l'internaute ne puisse voir le contenu de certains
champs).
Est-ce possible ?
Je ne vois pas comment fabriquer le formulaire et son contenu en mémoire
mais j'ai le présentiment qu'il doit-y avoir une solution...
D'avance merci
@+
Laurent
Bonsoir,
développer pour un contexte un peu particulier. Il vous faudra
(l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
stream) :
// retrieving stream content
int initBufferSize = 4000;
byte [] msgBuffer = new byte[initBufferSize];
MemoryStream memStream = new MemoryStream( initBufferSize );
int bytesRead = 0;
do
{
bytesRead = s.Read( msgBuffer, 0, initBufferSize );
memStream.Write( msgBuffer, 0, bytesRead );
} while ( bytesRead == initBufferSize );
memStream.Position = 0;
StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
string data = sr.ReadToEnd();
sr.Close();
byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information);
HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
config.URL );
oWRequest.Method = "POST";
oWRequest.ContentLength = postDataBytes.Length;
if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
{
WebProxy myProxy=new WebProxy();
// Obtain the Proxy Prperty of the Default browser.
myProxy=(WebProxy)oWRequest.Proxy;
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
config.ProxyPort );
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information);
// Associate the new Uri object to the myProxy object.
myProxy.Address=newUri;
// Create a NetworkCredential object and is assign to the
property of the Proxy object.
oWRequest.Proxy=myProxy;
}
Stream oS1 = oWRequest.GetRequestStream();
oS1.Write( postDataBytes, 0, postDataBytes.Length );
oS1.Close();
//la réponse (idem que pour un GET)
HttpWebResponse oWResponse =(HttpWebResponse)
Stream oS = oWResponse.GetResponseStream();
StreamReader oSReader = new
StreamReader(oS,System.Text.Encoding.ASCII);
string txtResult = oSReader.ReadToEnd();
oSReader.Close();
oS.Close();
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information);
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news: OHu%
> Salut @ tous,
>
> J'aurais besoin d'envoyer un formulaire en méthode post à partir du
> serveur
> web (pour éviter que l'internaute ne puisse voir le contenu de certains
> champs).
>
> Est-ce possible ?
>
> Je ne vois pas comment fabriquer le formulaire et son contenu en mémoire
> mais j'ai le présentiment qu'il doit-y avoir une solution...
>
> D'avance merci
>
> @+
>
> Laurent
>
>
Bonsoir,
développer pour un contexte un peu particulier. Il vous faudra
(l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
stream) :
// retrieving stream content
int initBufferSize = 4000;
byte [] msgBuffer = new byte[initBufferSize];
MemoryStream memStream = new MemoryStream( initBufferSize );
int bytesRead = 0;
do
{
bytesRead = s.Read( msgBuffer, 0, initBufferSize );
memStream.Write( msgBuffer, 0, bytesRead );
} while ( bytesRead == initBufferSize );
memStream.Position = 0;
StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
string data = sr.ReadToEnd();
sr.Close();
byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information);
HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
config.URL );
oWRequest.Method = "POST";
oWRequest.ContentLength = postDataBytes.Length;
if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
{
WebProxy myProxy=new WebProxy();
// Obtain the Proxy Prperty of the Default browser.
myProxy=(WebProxy)oWRequest.Proxy;
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
config.ProxyPort );
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information);
// Associate the new Uri object to the myProxy object.
myProxy.Address=newUri;
// Create a NetworkCredential object and is assign to the
property of the Proxy object.
oWRequest.Proxy=myProxy;
}
Stream oS1 = oWRequest.GetRequestStream();
oS1.Write( postDataBytes, 0, postDataBytes.Length );
oS1.Close();
//la réponse (idem que pour un GET)
HttpWebResponse oWResponse =(HttpWebResponse)
Stream oS = oWResponse.GetResponseStream();
StreamReader oSReader = new
StreamReader(oS,System.Text.Encoding.ASCII);
string txtResult = oSReader.ReadToEnd();
oSReader.Close();
oS.Close();
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information);
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news: OHu%233rHhEHA.3992@TK2MSFTNGP11.phx.gbl...
> Salut @ tous,
>
> J'aurais besoin d'envoyer un formulaire en méthode post à partir du
> serveur
> web (pour éviter que l'internaute ne puisse voir le contenu de certains
> champs).
>
> Est-ce possible ?
>
> Je ne vois pas comment fabriquer le formulaire et son contenu en mémoire
> mais j'ai le présentiment qu'il doit-y avoir une solution...
>
> D'avance merci
>
> @+
>
> Laurent
>
>
Bonsoir,
développer pour un contexte un peu particulier. Il vous faudra
(l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
stream) :
// retrieving stream content
int initBufferSize = 4000;
byte [] msgBuffer = new byte[initBufferSize];
MemoryStream memStream = new MemoryStream( initBufferSize );
int bytesRead = 0;
do
{
bytesRead = s.Read( msgBuffer, 0, initBufferSize );
memStream.Write( msgBuffer, 0, bytesRead );
} while ( bytesRead == initBufferSize );
memStream.Position = 0;
StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
string data = sr.ReadToEnd();
sr.Close();
byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information);
HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
config.URL );
oWRequest.Method = "POST";
oWRequest.ContentLength = postDataBytes.Length;
if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
{
WebProxy myProxy=new WebProxy();
// Obtain the Proxy Prperty of the Default browser.
myProxy=(WebProxy)oWRequest.Proxy;
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
config.ProxyPort );
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information);
// Associate the new Uri object to the myProxy object.
myProxy.Address=newUri;
// Create a NetworkCredential object and is assign to the
property of the Proxy object.
oWRequest.Proxy=myProxy;
}
Stream oS1 = oWRequest.GetRequestStream();
oS1.Write( postDataBytes, 0, postDataBytes.Length );
oS1.Close();
//la réponse (idem que pour un GET)
HttpWebResponse oWResponse =(HttpWebResponse)
Stream oS = oWResponse.GetResponseStream();
StreamReader oSReader = new
StreamReader(oS,System.Text.Encoding.ASCII);
string txtResult = oSReader.ReadToEnd();
oSReader.Close();
oS.Close();
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information);
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news: OHu%
> Salut @ tous,
>
> J'aurais besoin d'envoyer un formulaire en méthode post à partir du
> serveur
> web (pour éviter que l'internaute ne puisse voir le contenu de certains
> champs).
>
> Est-ce possible ?
>
> Je ne vois pas comment fabriquer le formulaire et son contenu en mémoire
> mais j'ai le présentiment qu'il doit-y avoir une solution...
>
> D'avance merci
>
> @+
>
> Laurent
>
>
Bonsoir,
développer pour un contexte un peu particulier. Il vous faudra
(l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
stream) :
// retrieving stream content
int initBufferSize = 4000;
byte [] msgBuffer = new byte[initBufferSize];
MemoryStream memStream = new MemoryStream( initBufferSize );
int bytesRead = 0;
do
{
bytesRead = s.Read( msgBuffer, 0, initBufferSize );
memStream.Write( msgBuffer, 0, bytesRead );
} while ( bytesRead == initBufferSize );
memStream.Position = 0;
StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
string data = sr.ReadToEnd();
sr.Close();
byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information);
HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
config.URL );
oWRequest.Method = "POST";
oWRequest.ContentLength = postDataBytes.Length;
if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
{
WebProxy myProxy=new WebProxy();
// Obtain the Proxy Prperty of the Default browser.
myProxy=(WebProxy)oWRequest.Proxy;
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
config.ProxyPort );
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information);
// Associate the new Uri object to the myProxy object.
myProxy.Address=newUri;
// Create a NetworkCredential object and is assign to the
property of the Proxy object.
oWRequest.Proxy=myProxy;
}
Stream oS1 = oWRequest.GetRequestStream();
oS1.Write( postDataBytes, 0, postDataBytes.Length );
oS1.Close();
//la réponse (idem que pour un GET)
HttpWebResponse oWResponse =(HttpWebResponse)
Stream oS = oWResponse.GetResponseStream();
StreamReader oSReader = new
StreamReader(oS,System.Text.Encoding.ASCII);
string txtResult = oSReader.ReadToEnd();
oSReader.Close();
oS.Close();
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information);
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news: OHu%
> Salut @ tous,
>
> J'aurais besoin d'envoyer un formulaire en méthode post à partir du
> serveur
> web (pour éviter que l'internaute ne puisse voir le contenu de certains
> champs).
>
> Est-ce possible ?
>
> Je ne vois pas comment fabriquer le formulaire et son contenu en mémoire
> mais j'ai le présentiment qu'il doit-y avoir une solution...
>
> D'avance merci
>
> @+
>
> Laurent
>
>
Bonsoir,
développer pour un contexte un peu particulier. Il vous faudra
(l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
stream) :
// retrieving stream content
int initBufferSize = 4000;
byte [] msgBuffer = new byte[initBufferSize];
MemoryStream memStream = new MemoryStream( initBufferSize );
int bytesRead = 0;
do
{
bytesRead = s.Read( msgBuffer, 0, initBufferSize );
memStream.Write( msgBuffer, 0, bytesRead );
} while ( bytesRead == initBufferSize );
memStream.Position = 0;
StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
string data = sr.ReadToEnd();
sr.Close();
byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information);
HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
config.URL );
oWRequest.Method = "POST";
oWRequest.ContentLength = postDataBytes.Length;
if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
{
WebProxy myProxy=new WebProxy();
// Obtain the Proxy Prperty of the Default browser.
myProxy=(WebProxy)oWRequest.Proxy;
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
config.ProxyPort );
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information);
// Associate the new Uri object to the myProxy object.
myProxy.Address=newUri;
// Create a NetworkCredential object and is assign to the
property of the Proxy object.
oWRequest.Proxy=myProxy;
}
Stream oS1 = oWRequest.GetRequestStream();
oS1.Write( postDataBytes, 0, postDataBytes.Length );
oS1.Close();
//la réponse (idem que pour un GET)
HttpWebResponse oWResponse =(HttpWebResponse)
Stream oS = oWResponse.GetResponseStream();
StreamReader oSReader = new
StreamReader(oS,System.Text.Encoding.ASCII);
string txtResult = oSReader.ReadToEnd();
oSReader.Close();
oS.Close();
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information);
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news: OHu%233rHhEHA.3992@TK2MSFTNGP11.phx.gbl...
> Salut @ tous,
>
> J'aurais besoin d'envoyer un formulaire en méthode post à partir du
> serveur
> web (pour éviter que l'internaute ne puisse voir le contenu de certains
> champs).
>
> Est-ce possible ?
>
> Je ne vois pas comment fabriquer le formulaire et son contenu en mémoire
> mais j'ai le présentiment qu'il doit-y avoir une solution...
>
> D'avance merci
>
> @+
>
> Laurent
>
>
Bonsoir,
développer pour un contexte un peu particulier. Il vous faudra
(l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
stream) :
// retrieving stream content
int initBufferSize = 4000;
byte [] msgBuffer = new byte[initBufferSize];
MemoryStream memStream = new MemoryStream( initBufferSize );
int bytesRead = 0;
do
{
bytesRead = s.Read( msgBuffer, 0, initBufferSize );
memStream.Write( msgBuffer, 0, bytesRead );
} while ( bytesRead == initBufferSize );
memStream.Position = 0;
StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
string data = sr.ReadToEnd();
sr.Close();
byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information);
HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
config.URL );
oWRequest.Method = "POST";
oWRequest.ContentLength = postDataBytes.Length;
if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
{
WebProxy myProxy=new WebProxy();
// Obtain the Proxy Prperty of the Default browser.
myProxy=(WebProxy)oWRequest.Proxy;
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
config.ProxyPort );
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information);
// Associate the new Uri object to the myProxy object.
myProxy.Address=newUri;
// Create a NetworkCredential object and is assign to the
property of the Proxy object.
oWRequest.Proxy=myProxy;
}
Stream oS1 = oWRequest.GetRequestStream();
oS1.Write( postDataBytes, 0, postDataBytes.Length );
oS1.Close();
//la réponse (idem que pour un GET)
HttpWebResponse oWResponse =(HttpWebResponse)
Stream oS = oWResponse.GetResponseStream();
StreamReader oSReader = new
StreamReader(oS,System.Text.Encoding.ASCII);
string txtResult = oSReader.ReadToEnd();
oSReader.Close();
oS.Close();
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information);
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news: OHu%
> Salut @ tous,
>
> J'aurais besoin d'envoyer un formulaire en méthode post à partir du
> serveur
> web (pour éviter que l'internaute ne puisse voir le contenu de certains
> champs).
>
> Est-ce possible ?
>
> Je ne vois pas comment fabriquer le formulaire et son contenu en mémoire
> mais j'ai le présentiment qu'il doit-y avoir une solution...
>
> D'avance merci
>
> @+
>
> Laurent
>
>
Salut,
Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
s)
Je vais quand même essayer de le traduire... mais ça a l'air dur...
@+
LJ
"Patrice Manac'h" a écrit dans le message
de
news:Bonsoir,
développer pour un contexte un peu particulier. Il vous faudra
personnaliser(l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
d'unstream) :
// retrieving stream content
int initBufferSize = 4000;
byte [] msgBuffer = new byte[initBufferSize];
MemoryStream memStream = new MemoryStream( initBufferSize );
int bytesRead = 0;
do
{
bytesRead = s.Read( msgBuffer, 0, initBufferSize );
memStream.Write( msgBuffer, 0, bytesRead );
} while ( bytesRead == initBufferSize );
memStream.Position = 0;
StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
string data = sr.ReadToEnd();
sr.Close();
byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information);
HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
config.URL );
oWRequest.Method = "POST";
oWRequest.ContentLength = postDataBytes.Length;
if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
{
WebProxy myProxy=new WebProxy();
// Obtain the Proxy Prperty of the Default browser.
myProxy=(WebProxy)oWRequest.Proxy;
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
config.ProxyPort );
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information);
// Associate the new Uri object to the myProxy object.
myProxy.Address=newUri;
// Create a NetworkCredential object and is assign to the
Credentialsproperty of the Proxy object.
oWRequest.Proxy=myProxy;
}
Stream oS1 = oWRequest.GetRequestStream();
oS1.Write( postDataBytes, 0, postDataBytes.Length );
oS1.Close();
//la réponse (idem que pour un GET)
HttpWebResponse oWResponse =(HttpWebResponse)
oWRequest.GetResponse();Stream oS = oWResponse.GetResponseStream();
StreamReader oSReader = new
StreamReader(oS,System.Text.Encoding.ASCII);
string txtResult = oSReader.ReadToEnd();
oSReader.Close();
oS.Close();
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information);
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
messagede news: OHu%
> Salut @ tous,
>
> J'aurais besoin d'envoyer un formulaire en méthode post à partir du
> serveur
> web (pour éviter que l'internaute ne puisse voir le contenu de certains
> champs).
>
> Est-ce possible ?
>
> Je ne vois pas comment fabriquer le formulaire et son contenu en
> mémoire
> mais j'ai le présentiment qu'il doit-y avoir une solution...
>
> D'avance merci
>
> @+
>
> Laurent
>
>
Salut,
Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
s)
Je vais quand même essayer de le traduire... mais ça a l'air dur...
@+
LJ
"Patrice Manac'h" <patmanac@online.microsoft.com> a écrit dans le message
de
news:OrTAFNIhEHA.216@tk2msftngp13.phx.gbl...
Bonsoir,
développer pour un contexte un peu particulier. Il vous faudra
personnaliser
(l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
d'un
stream) :
// retrieving stream content
int initBufferSize = 4000;
byte [] msgBuffer = new byte[initBufferSize];
MemoryStream memStream = new MemoryStream( initBufferSize );
int bytesRead = 0;
do
{
bytesRead = s.Read( msgBuffer, 0, initBufferSize );
memStream.Write( msgBuffer, 0, bytesRead );
} while ( bytesRead == initBufferSize );
memStream.Position = 0;
StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
string data = sr.ReadToEnd();
sr.Close();
byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information);
HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
config.URL );
oWRequest.Method = "POST";
oWRequest.ContentLength = postDataBytes.Length;
if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
{
WebProxy myProxy=new WebProxy();
// Obtain the Proxy Prperty of the Default browser.
myProxy=(WebProxy)oWRequest.Proxy;
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
config.ProxyPort );
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information);
// Associate the new Uri object to the myProxy object.
myProxy.Address=newUri;
// Create a NetworkCredential object and is assign to the
Credentials
property of the Proxy object.
oWRequest.Proxy=myProxy;
}
Stream oS1 = oWRequest.GetRequestStream();
oS1.Write( postDataBytes, 0, postDataBytes.Length );
oS1.Close();
//la réponse (idem que pour un GET)
HttpWebResponse oWResponse =(HttpWebResponse)
oWRequest.GetResponse();
Stream oS = oWResponse.GetResponseStream();
StreamReader oSReader = new
StreamReader(oS,System.Text.Encoding.ASCII);
string txtResult = oSReader.ReadToEnd();
oSReader.Close();
oS.Close();
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information);
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
message
de news: OHu%233rHhEHA.3992@TK2MSFTNGP11.phx.gbl...
> Salut @ tous,
>
> J'aurais besoin d'envoyer un formulaire en méthode post à partir du
> serveur
> web (pour éviter que l'internaute ne puisse voir le contenu de certains
> champs).
>
> Est-ce possible ?
>
> Je ne vois pas comment fabriquer le formulaire et son contenu en
> mémoire
> mais j'ai le présentiment qu'il doit-y avoir une solution...
>
> D'avance merci
>
> @+
>
> Laurent
>
>
Salut,
Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
s)
Je vais quand même essayer de le traduire... mais ça a l'air dur...
@+
LJ
"Patrice Manac'h" a écrit dans le message
de
news:Bonsoir,
développer pour un contexte un peu particulier. Il vous faudra
personnaliser(l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
d'unstream) :
// retrieving stream content
int initBufferSize = 4000;
byte [] msgBuffer = new byte[initBufferSize];
MemoryStream memStream = new MemoryStream( initBufferSize );
int bytesRead = 0;
do
{
bytesRead = s.Read( msgBuffer, 0, initBufferSize );
memStream.Write( msgBuffer, 0, bytesRead );
} while ( bytesRead == initBufferSize );
memStream.Position = 0;
StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
string data = sr.ReadToEnd();
sr.Close();
byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information);
HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
config.URL );
oWRequest.Method = "POST";
oWRequest.ContentLength = postDataBytes.Length;
if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
{
WebProxy myProxy=new WebProxy();
// Obtain the Proxy Prperty of the Default browser.
myProxy=(WebProxy)oWRequest.Proxy;
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
config.ProxyPort );
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information);
// Associate the new Uri object to the myProxy object.
myProxy.Address=newUri;
// Create a NetworkCredential object and is assign to the
Credentialsproperty of the Proxy object.
oWRequest.Proxy=myProxy;
}
Stream oS1 = oWRequest.GetRequestStream();
oS1.Write( postDataBytes, 0, postDataBytes.Length );
oS1.Close();
//la réponse (idem que pour un GET)
HttpWebResponse oWResponse =(HttpWebResponse)
oWRequest.GetResponse();Stream oS = oWResponse.GetResponseStream();
StreamReader oSReader = new
StreamReader(oS,System.Text.Encoding.ASCII);
string txtResult = oSReader.ReadToEnd();
oSReader.Close();
oS.Close();
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information);
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information);
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
messagede news: OHu%
> Salut @ tous,
>
> J'aurais besoin d'envoyer un formulaire en méthode post à partir du
> serveur
> web (pour éviter que l'internaute ne puisse voir le contenu de certains
> champs).
>
> Est-ce possible ?
>
> Je ne vois pas comment fabriquer le formulaire et son contenu en
> mémoire
> mais j'ai le présentiment qu'il doit-y avoir une solution...
>
> D'avance merci
>
> @+
>
> Laurent
>
>
Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news:
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" a écrit dans le
> de
> news:
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news: eEP5dNKhEHA.3664@TK2MSFTNGP12.phx.gbl...
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" <patmanac@online.microsoft.com> a écrit dans le
> de
> news:OrTAFNIhEHA.216@tk2msftngp13.phx.gbl...
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%233rHhEHA.3992@TK2MSFTNGP11.phx.gbl...
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news:
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" a écrit dans le
> de
> news:
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news:
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" a écrit dans le
> de
> news:
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news: eEP5dNKhEHA.3664@TK2MSFTNGP12.phx.gbl...
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" <patmanac@online.microsoft.com> a écrit dans le
> de
> news:OrTAFNIhEHA.216@tk2msftngp13.phx.gbl...
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%233rHhEHA.3992@TK2MSFTNGP11.phx.gbl...
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news:
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" a écrit dans le
> de
> news:
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
Salut,
J'aimerais bien savoir ou tu l'as trouvé ?
@+
LJ
"Patrice Manac'h" a écrit dans le message
de
news:Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
messagede news:
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb
> dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" a écrit dans le
message> de
> news:
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la
>> lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length >
>> 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
certains>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
Salut,
J'aimerais bien savoir ou tu l'as trouvé ?
@+
LJ
"Patrice Manac'h" <patmanac@online.microsoft.com> a écrit dans le message
de
news:enWv0IPhEHA.2544@TK2MSFTNGP10.phx.gbl...
Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
message
de news: eEP5dNKhEHA.3664@TK2MSFTNGP12.phx.gbl...
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb
> dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" <patmanac@online.microsoft.com> a écrit dans le
message
> de
> news:OrTAFNIhEHA.216@tk2msftngp13.phx.gbl...
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la
>> lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length >
>> 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%233rHhEHA.3992@TK2MSFTNGP11.phx.gbl...
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
certains
>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
Salut,
J'aimerais bien savoir ou tu l'as trouvé ?
@+
LJ
"Patrice Manac'h" a écrit dans le message
de
news:Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
messagede news:
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb
> dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" a écrit dans le
message> de
> news:
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la
>> lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length >
>> 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
certains>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
reSalut,
En tout cas merci... :)
A charge de revenche....
@+
LJ
"Patrice Manac'h" a écrit dans le message
de
news:Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
messagede news:
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb
> dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" a écrit dans le
message> de
> news:
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la
>> lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length >
>> 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
certains>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
reSalut,
En tout cas merci... :)
A charge de revenche....
@+
LJ
"Patrice Manac'h" <patmanac@online.microsoft.com> a écrit dans le message
de
news:enWv0IPhEHA.2544@TK2MSFTNGP10.phx.gbl...
Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
message
de news: eEP5dNKhEHA.3664@TK2MSFTNGP12.phx.gbl...
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb
> dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" <patmanac@online.microsoft.com> a écrit dans le
message
> de
> news:OrTAFNIhEHA.216@tk2msftngp13.phx.gbl...
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la
>> lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length >
>> 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%233rHhEHA.3992@TK2MSFTNGP11.phx.gbl...
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
certains
>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
reSalut,
En tout cas merci... :)
A charge de revenche....
@+
LJ
"Patrice Manac'h" a écrit dans le message
de
news:Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
messagede news:
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb
> dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" a écrit dans le
message> de
> news:
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la
>> lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length >
>> 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
certains>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
Bonsoir,
et cela marche ?
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news:
> reSalut,
>
> En tout cas merci... :)
>
> A charge de revenche....
>
> @+
>
> LJ
>
>
> "Patrice Manac'h" a écrit dans le
> de
> news:
>> Bonjour,
>>
>> en utilisant un traducteur automatique et donc non testé...
>>
>> Dim initBufferSize As Integer = 4000
>> Dim msgBuffer(initBufferSize) As Byte
>> Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
>> Dim bytesRead As Integer = 0
>> Do While
>> bytesRead = s.Read(msgBuffer, 0, initBufferSize)
>> memStream.Write(msgBuffer, 0, bytesRead)
>> LoopbytesRead = initBufferSize
>>
>> memStream.Position = 0
>>
>> Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
>> Dim data As String = sr.ReadToEnd()
>> sr.Close()
>> Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information)
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information)
>> Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
>> HttpWebRequest)
>> oWRequest.Method = "POST"
>> oWRequest.ContentLength = postDataBytes.Length
>>
>> If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0
>> Dim myProxy As WebProxy = New WebProxy ()
>> myProxy = CType(oWRequest.Proxy, WebProxy)
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
>> Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
>> config.ProxyPort)
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information)
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information)
>> myProxy.Address = newUri
>> oWRequest.Proxy = myProxy
>> End If
>>
>> Dim oS1 As Stream = oWRequest.GetRequestStream()
>> oS1.Write(postDataBytes, 0, postDataBytes.Length)
>> oS1.Close()
>> Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
>> HttpWebResponse)
>> Dim oS As Stream = oWResponse.GetResponseStream()
>> Dim oSReader As StreamReader = New StreamReader (oS,
>> System.Text.Encoding.ASCII)
>> Dim txtResult As String = oSReader.ReadToEnd()
>> oSReader.Close()
>> oS.Close()
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information)
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information)
>>
>> Cordialement,
>>
>> P. Manac'h
>> MCS France
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news:
>> > Salut,
>> >
>> > Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb
>> > dotnet...
>> > s)
>> >
>> > Je vais quand même essayer de le traduire... mais ça a l'air dur...
>> >
>> > @+
>> >
>> > LJ
>> > "Patrice Manac'h" a écrit dans le
> message
>> > de
>> > news:
>> >> Bonsoir,
>> >>
>> >> développer pour un contexte un peu particulier. Il vous faudra
>> > personnaliser
>> >> (l'utilisation d'UTF8 ou la création de la string plutôt que la
>> >> lecture
>> > d'un
>> >> stream) :
>> >> // retrieving stream content
>> >> int initBufferSize = 4000;
>> >> byte [] msgBuffer = new byte[initBufferSize];
>> >> MemoryStream memStream = new MemoryStream( initBufferSize );
>> >> int bytesRead = 0;
>> >> do
>> >> {
>> >> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> >> memStream.Write( msgBuffer, 0, bytesRead );
>> >> } while ( bytesRead == initBufferSize );
>> >>
>> >> memStream.Position = 0;
>> >>
>> >> StreamReader sr = new StreamReader( memStream,
>> >> string data = sr.ReadToEnd();
>> >> sr.Close();
>> >> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>> >>
>> >> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> >> EventLogEntryType.Information);
>> >> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> >> EventLogEntryType.Information);
>> >>
>> >> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> >> config.URL );
>> >> oWRequest.Method = "POST";
>> >> oWRequest.ContentLength = postDataBytes.Length;
>> >>
>> >> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length >
>> >> 0 )
>> >> {
>> >> WebProxy myProxy=new WebProxy();
>> >> // Obtain the Proxy Prperty of the Default browser.
>> >> myProxy=(WebProxy)oWRequest.Proxy;
>> >> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> >> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>> >>
>> >> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> >> config.ProxyPort );
>> >>
>> >> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> >> EventLogEntryType.Information);
>> >> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> >> EventLogEntryType.Information);
>> >>
>> >> // Associate the new Uri object to the myProxy object.
>> >> myProxy.Address=newUri;
>> >>
>> >> // Create a NetworkCredential object and is assign to the
>> > Credentials
>> >> property of the Proxy object.
>> >> oWRequest.Proxy=myProxy;
>> >> }
>> >>
>> >> Stream oS1 = oWRequest.GetRequestStream();
>> >> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> >> oS1.Close();
>> >>
>> >> //la réponse (idem que pour un GET)
>> >> HttpWebResponse oWResponse =(HttpWebResponse)
>> > oWRequest.GetResponse();
>> >> Stream oS = oWResponse.GetResponseStream();
>> >> StreamReader oSReader = new
>> >> StreamReader(oS,System.Text.Encoding.ASCII);
>> >> string txtResult = oSReader.ReadToEnd();
>> >> oSReader.Close();
>> >> oS.Close();
>> >>
>> >> EventLog.WriteEntry("HttpWO", "Satus: " +
>> >> EventLogEntryType.Information);
>> >> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> >> EventLogEntryType.Information);
>> >>
>> >>
>> >>
>> >>
>> >> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
>> > message
>> >> de news: OHu%
>> >> > Salut @ tous,
>> >> >
>> >> > J'aurais besoin d'envoyer un formulaire en méthode post à partir
>> >> > serveur
>> >> > web (pour éviter que l'internaute ne puisse voir le contenu de
> certains
>> >> > champs).
>> >> >
>> >> > Est-ce possible ?
>> >> >
>> >> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> >> > mémoire
>> >> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >> >
>> >> > D'avance merci
>> >> >
>> >> > @+
>> >> >
>> >> > Laurent
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
Bonsoir,
et cela marche ?
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news: edbQwqRhEHA.216@tk2msftngp13.phx.gbl...
> reSalut,
>
> En tout cas merci... :)
>
> A charge de revenche....
>
> @+
>
> LJ
>
>
> "Patrice Manac'h" <patmanac@online.microsoft.com> a écrit dans le
> de
> news:enWv0IPhEHA.2544@TK2MSFTNGP10.phx.gbl...
>> Bonjour,
>>
>> en utilisant un traducteur automatique et donc non testé...
>>
>> Dim initBufferSize As Integer = 4000
>> Dim msgBuffer(initBufferSize) As Byte
>> Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
>> Dim bytesRead As Integer = 0
>> Do While
>> bytesRead = s.Read(msgBuffer, 0, initBufferSize)
>> memStream.Write(msgBuffer, 0, bytesRead)
>> LoopbytesRead = initBufferSize
>>
>> memStream.Position = 0
>>
>> Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
>> Dim data As String = sr.ReadToEnd()
>> sr.Close()
>> Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information)
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information)
>> Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
>> HttpWebRequest)
>> oWRequest.Method = "POST"
>> oWRequest.ContentLength = postDataBytes.Length
>>
>> If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0
>> Dim myProxy As WebProxy = New WebProxy ()
>> myProxy = CType(oWRequest.Proxy, WebProxy)
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
>> Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
>> config.ProxyPort)
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information)
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information)
>> myProxy.Address = newUri
>> oWRequest.Proxy = myProxy
>> End If
>>
>> Dim oS1 As Stream = oWRequest.GetRequestStream()
>> oS1.Write(postDataBytes, 0, postDataBytes.Length)
>> oS1.Close()
>> Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
>> HttpWebResponse)
>> Dim oS As Stream = oWResponse.GetResponseStream()
>> Dim oSReader As StreamReader = New StreamReader (oS,
>> System.Text.Encoding.ASCII)
>> Dim txtResult As String = oSReader.ReadToEnd()
>> oSReader.Close()
>> oS.Close()
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information)
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information)
>>
>> Cordialement,
>>
>> P. Manac'h
>> MCS France
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: eEP5dNKhEHA.3664@TK2MSFTNGP12.phx.gbl...
>> > Salut,
>> >
>> > Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb
>> > dotnet...
>> > s)
>> >
>> > Je vais quand même essayer de le traduire... mais ça a l'air dur...
>> >
>> > @+
>> >
>> > LJ
>> > "Patrice Manac'h" <patmanac@online.microsoft.com> a écrit dans le
> message
>> > de
>> > news:OrTAFNIhEHA.216@tk2msftngp13.phx.gbl...
>> >> Bonsoir,
>> >>
>> >> développer pour un contexte un peu particulier. Il vous faudra
>> > personnaliser
>> >> (l'utilisation d'UTF8 ou la création de la string plutôt que la
>> >> lecture
>> > d'un
>> >> stream) :
>> >> // retrieving stream content
>> >> int initBufferSize = 4000;
>> >> byte [] msgBuffer = new byte[initBufferSize];
>> >> MemoryStream memStream = new MemoryStream( initBufferSize );
>> >> int bytesRead = 0;
>> >> do
>> >> {
>> >> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> >> memStream.Write( msgBuffer, 0, bytesRead );
>> >> } while ( bytesRead == initBufferSize );
>> >>
>> >> memStream.Position = 0;
>> >>
>> >> StreamReader sr = new StreamReader( memStream,
>> >> string data = sr.ReadToEnd();
>> >> sr.Close();
>> >> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>> >>
>> >> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> >> EventLogEntryType.Information);
>> >> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> >> EventLogEntryType.Information);
>> >>
>> >> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> >> config.URL );
>> >> oWRequest.Method = "POST";
>> >> oWRequest.ContentLength = postDataBytes.Length;
>> >>
>> >> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length >
>> >> 0 )
>> >> {
>> >> WebProxy myProxy=new WebProxy();
>> >> // Obtain the Proxy Prperty of the Default browser.
>> >> myProxy=(WebProxy)oWRequest.Proxy;
>> >> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> >> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>> >>
>> >> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> >> config.ProxyPort );
>> >>
>> >> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> >> EventLogEntryType.Information);
>> >> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> >> EventLogEntryType.Information);
>> >>
>> >> // Associate the new Uri object to the myProxy object.
>> >> myProxy.Address=newUri;
>> >>
>> >> // Create a NetworkCredential object and is assign to the
>> > Credentials
>> >> property of the Proxy object.
>> >> oWRequest.Proxy=myProxy;
>> >> }
>> >>
>> >> Stream oS1 = oWRequest.GetRequestStream();
>> >> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> >> oS1.Close();
>> >>
>> >> //la réponse (idem que pour un GET)
>> >> HttpWebResponse oWResponse =(HttpWebResponse)
>> > oWRequest.GetResponse();
>> >> Stream oS = oWResponse.GetResponseStream();
>> >> StreamReader oSReader = new
>> >> StreamReader(oS,System.Text.Encoding.ASCII);
>> >> string txtResult = oSReader.ReadToEnd();
>> >> oSReader.Close();
>> >> oS.Close();
>> >>
>> >> EventLog.WriteEntry("HttpWO", "Satus: " +
>> >> EventLogEntryType.Information);
>> >> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> >> EventLogEntryType.Information);
>> >>
>> >>
>> >>
>> >>
>> >> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
>> > message
>> >> de news: OHu%233rHhEHA.3992@TK2MSFTNGP11.phx.gbl...
>> >> > Salut @ tous,
>> >> >
>> >> > J'aurais besoin d'envoyer un formulaire en méthode post à partir
>> >> > serveur
>> >> > web (pour éviter que l'internaute ne puisse voir le contenu de
> certains
>> >> > champs).
>> >> >
>> >> > Est-ce possible ?
>> >> >
>> >> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> >> > mémoire
>> >> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >> >
>> >> > D'avance merci
>> >> >
>> >> > @+
>> >> >
>> >> > Laurent
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
Bonsoir,
et cela marche ?
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news:
> reSalut,
>
> En tout cas merci... :)
>
> A charge de revenche....
>
> @+
>
> LJ
>
>
> "Patrice Manac'h" a écrit dans le
> de
> news:
>> Bonjour,
>>
>> en utilisant un traducteur automatique et donc non testé...
>>
>> Dim initBufferSize As Integer = 4000
>> Dim msgBuffer(initBufferSize) As Byte
>> Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
>> Dim bytesRead As Integer = 0
>> Do While
>> bytesRead = s.Read(msgBuffer, 0, initBufferSize)
>> memStream.Write(msgBuffer, 0, bytesRead)
>> LoopbytesRead = initBufferSize
>>
>> memStream.Position = 0
>>
>> Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
>> Dim data As String = sr.ReadToEnd()
>> sr.Close()
>> Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information)
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information)
>> Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
>> HttpWebRequest)
>> oWRequest.Method = "POST"
>> oWRequest.ContentLength = postDataBytes.Length
>>
>> If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0
>> Dim myProxy As WebProxy = New WebProxy ()
>> myProxy = CType(oWRequest.Proxy, WebProxy)
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
>> Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
>> config.ProxyPort)
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information)
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information)
>> myProxy.Address = newUri
>> oWRequest.Proxy = myProxy
>> End If
>>
>> Dim oS1 As Stream = oWRequest.GetRequestStream()
>> oS1.Write(postDataBytes, 0, postDataBytes.Length)
>> oS1.Close()
>> Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
>> HttpWebResponse)
>> Dim oS As Stream = oWResponse.GetResponseStream()
>> Dim oSReader As StreamReader = New StreamReader (oS,
>> System.Text.Encoding.ASCII)
>> Dim txtResult As String = oSReader.ReadToEnd()
>> oSReader.Close()
>> oS.Close()
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information)
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information)
>>
>> Cordialement,
>>
>> P. Manac'h
>> MCS France
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news:
>> > Salut,
>> >
>> > Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb
>> > dotnet...
>> > s)
>> >
>> > Je vais quand même essayer de le traduire... mais ça a l'air dur...
>> >
>> > @+
>> >
>> > LJ
>> > "Patrice Manac'h" a écrit dans le
> message
>> > de
>> > news:
>> >> Bonsoir,
>> >>
>> >> développer pour un contexte un peu particulier. Il vous faudra
>> > personnaliser
>> >> (l'utilisation d'UTF8 ou la création de la string plutôt que la
>> >> lecture
>> > d'un
>> >> stream) :
>> >> // retrieving stream content
>> >> int initBufferSize = 4000;
>> >> byte [] msgBuffer = new byte[initBufferSize];
>> >> MemoryStream memStream = new MemoryStream( initBufferSize );
>> >> int bytesRead = 0;
>> >> do
>> >> {
>> >> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> >> memStream.Write( msgBuffer, 0, bytesRead );
>> >> } while ( bytesRead == initBufferSize );
>> >>
>> >> memStream.Position = 0;
>> >>
>> >> StreamReader sr = new StreamReader( memStream,
>> >> string data = sr.ReadToEnd();
>> >> sr.Close();
>> >> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>> >>
>> >> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> >> EventLogEntryType.Information);
>> >> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> >> EventLogEntryType.Information);
>> >>
>> >> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> >> config.URL );
>> >> oWRequest.Method = "POST";
>> >> oWRequest.ContentLength = postDataBytes.Length;
>> >>
>> >> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length >
>> >> 0 )
>> >> {
>> >> WebProxy myProxy=new WebProxy();
>> >> // Obtain the Proxy Prperty of the Default browser.
>> >> myProxy=(WebProxy)oWRequest.Proxy;
>> >> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> >> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>> >>
>> >> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> >> config.ProxyPort );
>> >>
>> >> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> >> EventLogEntryType.Information);
>> >> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> >> EventLogEntryType.Information);
>> >>
>> >> // Associate the new Uri object to the myProxy object.
>> >> myProxy.Address=newUri;
>> >>
>> >> // Create a NetworkCredential object and is assign to the
>> > Credentials
>> >> property of the Proxy object.
>> >> oWRequest.Proxy=myProxy;
>> >> }
>> >>
>> >> Stream oS1 = oWRequest.GetRequestStream();
>> >> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> >> oS1.Close();
>> >>
>> >> //la réponse (idem que pour un GET)
>> >> HttpWebResponse oWResponse =(HttpWebResponse)
>> > oWRequest.GetResponse();
>> >> Stream oS = oWResponse.GetResponseStream();
>> >> StreamReader oSReader = new
>> >> StreamReader(oS,System.Text.Encoding.ASCII);
>> >> string txtResult = oSReader.ReadToEnd();
>> >> oSReader.Close();
>> >> oS.Close();
>> >>
>> >> EventLog.WriteEntry("HttpWO", "Satus: " +
>> >> EventLogEntryType.Information);
>> >> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> >> EventLogEntryType.Information);
>> >>
>> >>
>> >>
>> >>
>> >> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
>> > message
>> >> de news: OHu%
>> >> > Salut @ tous,
>> >> >
>> >> > J'aurais besoin d'envoyer un formulaire en méthode post à partir
>> >> > serveur
>> >> > web (pour éviter que l'internaute ne puisse voir le contenu de
> certains
>> >> > champs).
>> >> >
>> >> > Est-ce possible ?
>> >> >
>> >> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> >> > mémoire
>> >> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >> >
>> >> > D'avance merci
>> >> >
>> >> > @+
>> >> >
>> >> > Laurent
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news:
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" a écrit dans le
> de
> news:
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news: eEP5dNKhEHA.3664@TK2MSFTNGP12.phx.gbl...
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" <patmanac@online.microsoft.com> a écrit dans le
> de
> news:OrTAFNIhEHA.216@tk2msftngp13.phx.gbl...
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%233rHhEHA.3992@TK2MSFTNGP11.phx.gbl...
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>
Bonjour,
en utilisant un traducteur automatique et donc non testé...
Dim initBufferSize As Integer = 4000
Dim msgBuffer(initBufferSize) As Byte
Dim memStream As MemoryStream = New MemoryStream (initBufferSize)
Dim bytesRead As Integer = 0
Do While
bytesRead = s.Read(msgBuffer, 0, initBufferSize)
memStream.Write(msgBuffer, 0, bytesRead)
LoopbytesRead = initBufferSize
memStream.Position = 0
Dim sr As StreamReader = New StreamReader (memStream, Encoding.UTF8)
Dim data As String = sr.ReadToEnd()
sr.Close()
Dim postDataBytes As Byte = Encoding.UTF8.GetBytes(data)
EventLog.WriteEntry("HttpWO", "Data: " + data,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
EventLogEntryType.Information)
Dim oWRequest As HttpWebRequest = CType(WebRequest.Create(config.URL),
HttpWebRequest)
oWRequest.Method = "POST"
oWRequest.ContentLength = postDataBytes.Length
If config.ProxyServer.Length > 0 AndAlso config.ProxyPort.Length > 0 Then
Dim myProxy As WebProxy = New WebProxy ()
myProxy = CType(oWRequest.Proxy, WebProxy)
EventLog.WriteEntry("HttpWO", "Current Proxy: " +
myProxy.Address.AbsoluteUri, EventLogEntryType.Information)
Dim newUri As Uri = New Uri ("http://" + config.ProxyServer + ":" +
config.ProxyPort)
EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
EventLogEntryType.Information)
myProxy.Address = newUri
oWRequest.Proxy = myProxy
End If
Dim oS1 As Stream = oWRequest.GetRequestStream()
oS1.Write(postDataBytes, 0, postDataBytes.Length)
oS1.Close()
Dim oWResponse As HttpWebResponse = CType(oWRequest.GetResponse(),
HttpWebResponse)
Dim oS As Stream = oWResponse.GetResponseStream()
Dim oSReader As StreamReader = New StreamReader (oS,
System.Text.Encoding.ASCII)
Dim txtResult As String = oSReader.ReadToEnd()
oSReader.Close()
oS.Close()
EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
EventLogEntryType.Information)
EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
EventLogEntryType.Information)
Cordialement,
P. Manac'h
MCS France
"Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
de news:
> Salut,
>
> Je sais que j'abuse, mais tu n'aurais pas le meme en vb ou vb dotnet...
> s)
>
> Je vais quand même essayer de le traduire... mais ça a l'air dur...
>
> @+
>
> LJ
> "Patrice Manac'h" a écrit dans le
> de
> news:
>> Bonsoir,
>>
>> développer pour un contexte un peu particulier. Il vous faudra
> personnaliser
>> (l'utilisation d'UTF8 ou la création de la string plutôt que la lecture
> d'un
>> stream) :
>> // retrieving stream content
>> int initBufferSize = 4000;
>> byte [] msgBuffer = new byte[initBufferSize];
>> MemoryStream memStream = new MemoryStream( initBufferSize );
>> int bytesRead = 0;
>> do
>> {
>> bytesRead = s.Read( msgBuffer, 0, initBufferSize );
>> memStream.Write( msgBuffer, 0, bytesRead );
>> } while ( bytesRead == initBufferSize );
>>
>> memStream.Position = 0;
>>
>> StreamReader sr = new StreamReader( memStream, Encoding.UTF8 );
>> string data = sr.ReadToEnd();
>> sr.Close();
>> byte[] postDataBytes = Encoding.UTF8.GetBytes( data );
>>
>> EventLog.WriteEntry("HttpWO", "Data: " + data,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "URL: " + config.URL,
>> EventLogEntryType.Information);
>>
>> HttpWebRequest oWRequest =(HttpWebRequest) WebRequest.Create(
>> config.URL );
>> oWRequest.Method = "POST";
>> oWRequest.ContentLength = postDataBytes.Length;
>>
>> if( config.ProxyServer.Length > 0 && config.ProxyPort.Length > 0 )
>> {
>> WebProxy myProxy=new WebProxy();
>> // Obtain the Proxy Prperty of the Default browser.
>> myProxy=(WebProxy)oWRequest.Proxy;
>> EventLog.WriteEntry("HttpWO", "Current Proxy: " +
>> myProxy.Address.AbsoluteUri, EventLogEntryType.Information);
>>
>> Uri newUri=new Uri("http://" + config.ProxyServer + ":" +
>> config.ProxyPort );
>>
>> EventLog.WriteEntry("HttpWO", "Proxy: " + config.ProxyServer,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Port: " + config.ProxyPort,
>> EventLogEntryType.Information);
>>
>> // Associate the new Uri object to the myProxy object.
>> myProxy.Address=newUri;
>>
>> // Create a NetworkCredential object and is assign to the
> Credentials
>> property of the Proxy object.
>> oWRequest.Proxy=myProxy;
>> }
>>
>> Stream oS1 = oWRequest.GetRequestStream();
>> oS1.Write( postDataBytes, 0, postDataBytes.Length );
>> oS1.Close();
>>
>> //la réponse (idem que pour un GET)
>> HttpWebResponse oWResponse =(HttpWebResponse)
> oWRequest.GetResponse();
>> Stream oS = oWResponse.GetResponseStream();
>> StreamReader oSReader = new
>> StreamReader(oS,System.Text.Encoding.ASCII);
>> string txtResult = oSReader.ReadToEnd();
>> oSReader.Close();
>> oS.Close();
>>
>> EventLog.WriteEntry("HttpWO", "Satus: " + oWResponse.StatusCode,
>> EventLogEntryType.Information);
>> EventLog.WriteEntry("HttpWO", "Response: " + txtResult,
>> EventLogEntryType.Information);
>>
>>
>>
>>
>> "Laurent Jordi (www.ezlogic.mc)" <inf[o]@ezlogic.mc> a écrit dans le
> message
>> de news: OHu%
>> > Salut @ tous,
>> >
>> > J'aurais besoin d'envoyer un formulaire en méthode post à partir du
>> > serveur
>> > web (pour éviter que l'internaute ne puisse voir le contenu de
>> > champs).
>> >
>> > Est-ce possible ?
>> >
>> > Je ne vois pas comment fabriquer le formulaire et son contenu en
>> > mémoire
>> > mais j'ai le présentiment qu'il doit-y avoir une solution...
>> >
>> > D'avance merci
>> >
>> > @+
>> >
>> > Laurent
>> >
>> >
>>
>>
>
>