How to marshall parameters in winhttpopenrequest()?

S

selva

hi
i am using the following c# code in winhttp to open a http request
Win32Api.WinHttpOpenRequest(Winconnection,"POST","/winn/01Primary/",null,"W­INHTTP_NO_REFERER",WINHTTP_DEFAULT_ACCEPT_TYPES,0x00800000);


and my function marshalling looks like
[DllImport("winhttp.dll",
SetLastError=true)]
public static extern IntPtr WinHttpOpenRequest(

IntPtr hConnect,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszVerb,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszObjectName,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszVersion,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszReferrer,
ref byte[] ppwszAcceptTypes,
int dwFlags);


i don't know what is the constant value for
WINHTTP_NO_REFERER and WINHTTP_DEFAULT_ACCEPT_TYPES
to be specified in the WinHttpOpenRequest() function for these two
parameters
[MarshalAs(UnmanagedType.LPWStr)]
string pwszReferrer,
ref byte[] ppwszAcceptTypes,


please help me regarding this issue


regards
bharathi
 
D

Dave Sexton

Hi Bharathi,

Have you seen the System.Net.HttpWebRequest class?

"HttpWebRequest Class"
http://msdn2.microsoft.com/en-gb/library/system.net.httpwebrequest.aspx

I'm not sure if it'll do what you want, but it's probably worth checking out.

--
Dave Sexton

hi
i am using the following c# code in winhttp to open a http request
Win32Api.WinHttpOpenRequest(Winconnection,"POST","/winn/01Primary/",null,"W­INHTTP_NO_REFERER",WINHTTP_DEFAULT_ACCEPT_TYPES,0x00800000);


and my function marshalling looks like
[DllImport("winhttp.dll",
SetLastError=true)]
public static extern IntPtr WinHttpOpenRequest(

IntPtr hConnect,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszVerb,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszObjectName,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszVersion,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszReferrer,
ref byte[] ppwszAcceptTypes,
int dwFlags);


i don't know what is the constant value for
WINHTTP_NO_REFERER and WINHTTP_DEFAULT_ACCEPT_TYPES
to be specified in the WinHttpOpenRequest() function for these two
parameters
[MarshalAs(UnmanagedType.LPWStr)]
string pwszReferrer,
ref byte[] ppwszAcceptTypes,


please help me regarding this issue


regards
bharathi
 

Ask a Question

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

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

Ask a Question

Top