Click here to Skip to main content
15,921,959 members
Home / Discussions / C#
   

C#

 
AnswerRe: Store Key / Value Pair Pin
S. Senthil Kumar7-Jan-09 5:47
S. Senthil Kumar7-Jan-09 5:47 
GeneralRe: Store Key / Value Pair Pin
mark_w_7-Jan-09 5:52
mark_w_7-Jan-09 5:52 
Questionretrieving the last increment value in a table Pin
bfis1081377-Jan-09 4:22
bfis1081377-Jan-09 4:22 
AnswerRe: retrieving the last increment value in a table Pin
Wendelius7-Jan-09 4:25
mentorWendelius7-Jan-09 4:25 
GeneralRe: retrieving the last increment value in a table Pin
bfis1081377-Jan-09 4:26
bfis1081377-Jan-09 4:26 
GeneralRe: retrieving the last increment value in a table Pin
Wendelius7-Jan-09 4:30
mentorWendelius7-Jan-09 4:30 
GeneralRe: retrieving the last increment value in a table Pin
Dave Kreskowiak7-Jan-09 6:07
mveDave Kreskowiak7-Jan-09 6:07 
QuestionRead a Webpage content. Pin
AksharRoop7-Jan-09 4:13
AksharRoop7-Jan-09 4:13 
I am writing an application that will give me content of a web page.

I wrote following code for that.
WebRequest objRequest = HttpWebRequest.Create("url");
StreamReader sr = new StreamReader(objRequest.GetResponse().GetResponseStream());
string result = sr.ReadToEnd();
sr.Close();

This works fine if the url i am connecting to does not require to login.

I want to read content of a web page which requires first to put in login details (user/password) to get access.

for that i tried with
WebRequest objRequest = HttpWebRequest.Create("url");
NetworkCredential netCred = new NetworkCredential("User","Password");
objRequest.Credentials = netCred;
StreamReader sr = new StreamReader(objRequest.GetResponse().GetResponseStream());
string result = sr.ReadToEnd();
sr.Close();

No success with this as well. It gets the contents of log in page and not the one specified by url.

Can anyone help me with this?
How to Read contents of a webpage which requires to login first.

Thanks,
AksharRoop
AnswerRe: Read a Webpage content. Pin
Colin Angus Mackay7-Jan-09 5:55
Colin Angus Mackay7-Jan-09 5:55 
GeneralRe: Read a Webpage content. Pin
AksharRoop7-Jan-09 19:57
AksharRoop7-Jan-09 19:57 
GeneralRe: Read a Webpage content. Pin
Colin Angus Mackay7-Jan-09 21:37
Colin Angus Mackay7-Jan-09 21:37 
QuestionRe: Read a Webpage content. Pin
AksharRoop7-Jan-09 23:25
AksharRoop7-Jan-09 23:25 
QuestionWhen is goto acceptable? Pin
Dewald7-Jan-09 4:05
Dewald7-Jan-09 4:05 
AnswerRe: When is goto acceptable? Pin
Alan Balkany7-Jan-09 4:15
Alan Balkany7-Jan-09 4:15 
AnswerRe: When is goto acceptable? Pin
Jon Rista7-Jan-09 4:18
Jon Rista7-Jan-09 4:18 
AnswerRe: When is goto acceptable? Pin
#realJSOP7-Jan-09 4:40
professional#realJSOP7-Jan-09 4:40 
JokeRe: When is goto acceptable? Pin
Giorgi Dalakishvili7-Jan-09 5:05
mentorGiorgi Dalakishvili7-Jan-09 5:05 
AnswerRe: When is goto acceptable? Pin
Wendelius7-Jan-09 5:05
mentorWendelius7-Jan-09 5:05 
GeneralRe: When is goto acceptable? Pin
DaveyM697-Jan-09 5:16
professionalDaveyM697-Jan-09 5:16 
GeneralRe: When is goto acceptable? Pin
Wendelius7-Jan-09 5:21
mentorWendelius7-Jan-09 5:21 
GeneralRe: When is goto acceptable? Pin
CPallini7-Jan-09 6:12
mveCPallini7-Jan-09 6:12 
JokeRe: When is goto acceptable? Pin
Luc Pattyn7-Jan-09 6:34
sitebuilderLuc Pattyn7-Jan-09 6:34 
AnswerRe: When is goto acceptable? Pin
Guffa7-Jan-09 5:17
Guffa7-Jan-09 5:17 
AnswerRe: When is goto acceptable? Pin
Dan Neely7-Jan-09 5:29
Dan Neely7-Jan-09 5:29 
GeneralRe: When is goto acceptable? Pin
Luc Pattyn7-Jan-09 6:32
sitebuilderLuc Pattyn7-Jan-09 6:32 

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.