473,320 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Logging in on a page ...

I should access page which requires authorization...

Now, I'm using .net c#... and would like to know how to do that logging on that kind of page?

Thanks all and sorry for my English! ;)

BR
Igor
Jul 25 '06 #1
4 1122
Alfa & Omega wrote:
I should access page which requires authorization...
Now, I'm using .net c#... and would like to know how
to do that logging on that kind of page?
Do you mean that you want to download a Web page protected by
Basic-Auth?

HttpWebRequest req = (HttpWebRequest)
WebRequest.Create("http://example.com/");
req.Credentials = new NetworkCredential("user", "pass");
HttpWebResponse resp = (HttpWebResponse) req.GetResponse();
using (StreamReader reader = new
StreamReader(resp.GetResponseStream()))
{
string response = reader.ReadToEnd();
reader.Close();
}

Eq.
Jul 25 '06 #2
Hi,

You use Webrequest to access a web page.

Take a look at the Credentials property

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Alfa & Omega" <al*****@gmail.comwrote in message
news:ea**********@ss408.t-com.hr...
>I should access page which requires authorization...

Now, I'm using .net c#... and would like to know how to do that logging on
that kind of page?

Thanks all and sorry for my English! ;)

BR
Igor


Jul 25 '06 #3
"Paul E Collins" <fi******************@CL4.orgwrote in message
news:9f******************************@bt.com...
| Alfa & Omega wrote:
|
| Do you mean that you want to download a Web page protected by
| Basic-Auth?
|
| HttpWebRequest req = (HttpWebRequest)
| WebRequest.Create("http://example.com/");
| req.Credentials = new NetworkCredential("user", "pass");
| HttpWebResponse resp = (HttpWebResponse) req.GetResponse();
| using (StreamReader reader = new
| StreamReader(resp.GetResponseStream()))
| {
| string response = reader.ReadToEnd();
| reader.Close();
| }
|
| Eq.
|
Yes..that's what I want...download page which is protected by basic -auth...

But now comes the problem ;)..

I tried the code you gave me but it won't work...is there maybe any other way to do this?

page is http://www.vip.hr/sp/d_sendSMS? .... it's internet portal for sending SMS messages in my
country (Croatia)

So, I was thinking of making application which would log on that page and from that application I
would send messages like from my web browser....problem is that I can't access that page...I can't
log in by this solution..is there any other?

Thanks!
Jul 25 '06 #4
Alfa & Omega wrote:
Yes..that's what I want...download page which is protected
by basic-auth...
But now comes the problem ;)..
I tried the code you gave me but it won't work...
Looking at the page whose address you posted, it isn't Basic-Auth, but
some custom login with form fields.

There's no standard way to log in to any arbitrary Web site like that.
You'd have to generate and submit a form: you can do that with .NET
(similar to what I posted, but using POST method and filling in the
fields), but it will stop working if they ever change their Web site.
It's going to be quite messy and fragile, however you do it.

Eq.
Jul 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Logan | last post by:
Is there actually a good reason why the StreamHandler and the FileHandler are in the core package and all other handlers are in logging.handlers? I first did not realize this when reading the...
1
by: jjesso | last post by:
I am trying to add a new logging level. logging.config.fileConfig("bengineLog.cfg") logging.CLIENT = logging.INFO + 1 logging.addLevelName( logging.CLIENT, 'CLIENT' ) logging.root.setLevel( )...
0
by: Karuppasamy | last post by:
H I am trying to use the Logging Module provided by Microsoft Application Blocks for .Net I installed everything as per the Instructions given in the 'Development Using the Logging Block' ...
6
by: pmatos | last post by:
Hi all, I am trying to create a simple but efficient C++ logging class. I know there are lots of them out there but I want something simple and efficient. The number one requirement is the...
5
by: Michelle Stone | last post by:
Hi everybody I am writing a simple asp.net application using form authentication. I store the list of all users and their passwords in an SQL Server database table. My client recently told me...
6
by: Matt | last post by:
I have an ASP.Net page that receives batch transmissions of data from clients. I would like to add some type of logging to this application so I can review transmission issues easily. I tried...
3
by: Dick | last post by:
How do I integrating ASP.NET Tracing with the Enterprise Library Logging Application Block? I guess this should be possible and in a similar way to the way ASP.NET Tracing is integrated with...
0
by: robert | last post by:
As more and more python packages are starting to use the bloomy (Java-ish) 'logging' module in a mood of responsibility and as I am not overly happy with the current "thickener" style of usage, I...
1
by: Tom Kearney | last post by:
Hi - I'm trying to use "Microsoft.VisualBasic.Logging.FileLogTraceListener" from a set of C# aspx web pages, but I can't seem to use: <%@ Import Namespace="Microsoft.VisualBasic.Logging" %> I...
5
by: Shiao | last post by:
Hi, I am getting duplicate log entries with the logging module. The following behaves as expected, leading to one log entry for each logged event: logging.basicConfig(level=logging.DEBUG,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.