Click here to Skip to main content
15,903,201 members
Home / Discussions / C#
   

C#

 
GeneralDrag & Drop Interface Pin
johnstacey2-Feb-04 15:05
johnstacey2-Feb-04 15:05 
GeneralRe: Drag & Drop Interface Pin
John Fisher3-Feb-04 4:22
John Fisher3-Feb-04 4:22 
GeneralRe: Drag & Drop Interface Pin
Heath Stewart3-Feb-04 4:54
protectorHeath Stewart3-Feb-04 4:54 
GeneralRe: Drag & Drop Interface Pin
johnstacey3-Feb-04 11:42
johnstacey3-Feb-04 11:42 
GeneralSerializable socket Pin
Snowjim2-Feb-04 14:40
Snowjim2-Feb-04 14:40 
GeneralRe: Serializable socket Pin
Heath Stewart3-Feb-04 5:10
protectorHeath Stewart3-Feb-04 5:10 
GeneralCookies problem... Pin
profoundwhispers2-Feb-04 14:20
profoundwhispers2-Feb-04 14:20 
GeneralRe: Cookies problem... Pin
Heath Stewart3-Feb-04 5:16
protectorHeath Stewart3-Feb-04 5:16 
First of all, the cookie should NOT have the password contained within it. This is very insecure. The web site should authenticate the credentials in whatever way is fit (say, BASIC authentication of HTTPS) and return a ticket that signifies that the credentials have been authenticated. This is the underlying concept of authentication.

Second, if you have the username and password, you could make the call to the web server to get the ticket and that should return you the cookie. In order to accept the cookie, though, your HttpWebRequest.CookieContainer must be initialized:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.codeproject.com");
request.CookieContainer = new CookieContainer();
// Add cookies if necessary and make request
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
This example if very basic, but you can find more information in the documentation for HttpWebRequest.CookieContainer.

Additionally, you can also pass the username and password to the initial request to avoid making several requests. You'll still need the initialized CookieContainer to store the response cookies (and use that over for every request and response), but you can put the username, password, and domain in a NetworkCredential and assign that to the HttpWebRequest.Credentials property before getting the response (which commits the request). See the documentation for the HttpWebRequest.Credentials property in the .NET Framework SDK for more information.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Cookies problem... Pin
profoundwhispers3-Feb-04 7:52
profoundwhispers3-Feb-04 7:52 
GeneralRe: Cookies problem... Pin
Heath Stewart3-Feb-04 8:54
protectorHeath Stewart3-Feb-04 8:54 
GeneralRe: Cookies problem... Pin
profoundwhispers3-Feb-04 9:17
profoundwhispers3-Feb-04 9:17 
GeneralRe: Cookies problem... Pin
Heath Stewart3-Feb-04 9:38
protectorHeath Stewart3-Feb-04 9:38 
GeneralRe: Cookies problem... Pin
profoundwhispers3-Feb-04 9:58
profoundwhispers3-Feb-04 9:58 
GeneralRe: Cookies problem... Pin
Heath Stewart3-Feb-04 10:25
protectorHeath Stewart3-Feb-04 10:25 
GeneralRe: Cookies problem... Pin
profoundwhispers3-Feb-04 10:40
profoundwhispers3-Feb-04 10:40 
GeneralRe: Cookies problem... Pin
profoundwhispers3-Feb-04 10:46
profoundwhispers3-Feb-04 10:46 
GeneralRe: Cookies problem... Pin
Heath Stewart3-Feb-04 10:53
protectorHeath Stewart3-Feb-04 10:53 
GeneralC# exceptions not showing filename/line numbers (PDB issue?) Pin
Arun Bhalla2-Feb-04 13:12
Arun Bhalla2-Feb-04 13:12 
GeneralRe: C# exceptions not showing filename/line numbers (PDB issue?) Pin
Heath Stewart3-Feb-04 5:22
protectorHeath Stewart3-Feb-04 5:22 
GeneralRe: C# exceptions not showing filename/line numbers (PDB issue?) Pin
Arun Bhalla3-Feb-04 7:49
Arun Bhalla3-Feb-04 7:49 
GeneralRe: C# exceptions not showing filename/line numbers (PDB issue?) Pin
Heath Stewart3-Feb-04 8:49
protectorHeath Stewart3-Feb-04 8:49 
GeneralRe: C# exceptions not showing filename/line numbers (PDB issue?) Pin
Arun Bhalla3-Feb-04 10:26
Arun Bhalla3-Feb-04 10:26 
GeneralRe: C# exceptions not showing filename/line numbers (PDB issue?) Pin
Heath Stewart3-Feb-04 10:32
protectorHeath Stewart3-Feb-04 10:32 
GeneralRe: C# exceptions not showing filename/line numbers (PDB issue?) Pin
Arun Bhalla3-Feb-04 11:08
Arun Bhalla3-Feb-04 11:08 
GeneralRe: C# exceptions not showing filename/line numbers (PDB issue?) Pin
Heath Stewart3-Feb-04 11:15
protectorHeath Stewart3-Feb-04 11:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.