|
i see all the methods but when i use it gets this error..
ERROR: 'System.Web.Services.WebService' does not contain a definition for 'CheckUser'
and all methods also..
|
|
|
|
|
Mtyb wrote: System.Web.Services.WebService
This is a .Net class. You will find the method in the object of the web service you have added and not this one.
You need to add reference to the web service you need to consume. Then create its object and call the method.
PS: How come I didn't noticed the class name? Oh yes...it was Wimbledon final.
|
|
|
|
|
Hi, suppose i have an imaginary web address like this with all the query parameter:
http://sokim.seltekom.com/sokim/index.php?do=queryWrite.rewrite&varA=89898&post=1&edat=02-07-2009
I'm using a source code from http://blog.brezovsky.net/
(How to Post data in C# . NET HttpWebRequest)
This is the code :
public static string Post(string url, string data)
{
string vystup = null;
try
{
//Our postvars
byte[] buffer = Encoding.ASCII.GetBytes(data);
//Initialisation, we use localhost, change if appliable
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(url);
//Our method is post, otherwise the buffer (postvars) would be useless
WebReq.Method = "POST";
//We use form contentType, for the postvars.
WebReq.ContentType = "application/x-www-form-urlencoded";
//The length of the buffer (postvars) is used as contentlength.
WebReq.ContentLength = buffer.Length;
//We open a stream for writing the postvars
Stream PostData = WebReq.GetRequestStream();
//Now we write, and afterwards, we close. Closing is always important!
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
//Get the response handle, we have no true response yet!
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
//Let's show some information about the response
Console.WriteLine(WebResp.StatusCode);
Console.WriteLine(WebResp.Server);
//Stream s = WebResp.GetResponseStream();
//StreamReader sr = new StreamReader(s);
//Now, we read the response (the string), and output it.
Stream Answer = WebResp.GetResponseStream();
StreamReader _Answer = new StreamReader(Answer);
vystup = _Answer.ReadToEnd();
//Console.ReadLine();
//Congratulations, you just requested your first POST page, you
//can now start logging into most login forms, with your application
//Or other examples.
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return vystup.Trim() + "\n";
}
This is what i do:
static void Main(string[] args)
{
Console.Write(Post("http://sokim.seltekom.com/sokim/index.php",
"?do=queryWrite.rewrite&varA=89898&post=1&edat=02-07-2009"));
Console.ReadLine();
}
The problem is, the Console always give me the login page source code. I think maybe it's because of wrong url or data pass to the function. But after i try many combination (like remove the '?' sign) it keep give me the login page html source.
For information, the web site has a login page where i must enter user id and password
and i have privilege to access it.
Before i run the above code, i manually sign in to the web site (i think so i can have session registered on the server). After that then i run the above code.
What i'm trying to do is, pull the data from the web page on html format, then with a few string function to get the actual data i need from the html source code.
It has many link inside that it will exhausted to do it manually.
I want make a program to pull the data out and save it to my database.
Can anyone help?
|
|
|
|
|
I didnt examen you code completely but you say the url is protected by a password. Mostly what happens if you login is that a cookie is placed on your computer. You must refer to this cookie in following accesses to that server. If you do not, the server thinks you re an unregistered user and redirects you to the login page.
You can test this by putting cookies off in your browser (and delete all temporary internet files - don't forget this) and then login. If you can't get in it will use cookies. Next test: Login, now delete all temporary internet files, set cookies off and try to open a page with your browser.... This checks if cookies are used for the page you asked for.
Rozis
|
|
|
|
|
I didn't quite understand what you mean.
But, i think what your point is like this ?
<br />
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://sokim.seltekom.com/sokim/index.php?do=default");<br />
request.CookieContainer = new CookieContainer();<br />
<br />
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
First, i trying to get the cookie and then put the cookie on the next request?
WebReq.CookieContainer.Add(response.Cookies[0]);<br />
Stream PostData = WebReq.GetRequestStream();<br />
PostData.Write(buffer, 0, buffer.Length);<br />
PostData.Close();<br />
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();<br />
<br />
Stream Answer = WebResp.GetResponseStream();<br />
StreamReader _Answer = new StreamReader(Answer);<br />
vystup = _Answer.ReadToEnd();
Like that?
When i tried above code, the vystup is always NULL (no response)
|
|
|
|
|
I can't judge your code, simply because i do not use C#. But i have some knowledge on how Http works. I'm used to open a socket, program the http-protocol, and analyse the data by myself.
So let the deaf help the blind... Guess the first 4 lines let you login. You type in the ID and password. If you are granted a cookie will be placed on your computer. Now for every next request you should refer to the cookie.
The next 5 lines i don't understand. It seems you want to get the cookie what seems a good approach. But I would expect they where already in request.CookieContainer, but again im not a C# programmer.
Think some good C# programmer takes it over from me from here.... I'm sorry
Rozis
|
|
|
|
|
Yes, i'm sure that the cookie already on my computer (since i have log in manually).
What i'm trying to do is to pull the data out from the web.
the data is about sales.
the problem is, the data is too many.
if i want to do it manually, it will take a lot of time to do it,
since it has about 400 reseller and each reseller i want to pull sales data by certain date (i do this by manipulate the url). and then i extract the data out from the html table and then put the data on my database for analysis.
That's what i'm trying to accomplish.
I had mind to use php. looping through all the reseller id and using javascript to open new window presenting the sales data by an reseller on certain date. After that i must capture the data manually. so the windows is about 400 window and a lot of hours for me to capture the data and input it on my database.
Is there any suggestion? maybe with another approaches?
|
|
|
|
|
Dear friends,
I want to make application like windows Update in C#. As I know that windows update use BITS (Background intelligence services).But, I don’t know how to use BITS in C#. If any body has sample code or reference .Please let me know. Or suggest me what approach should I follow to make auto updating application in c#.
Regards,
Rajesh
rajesh
|
|
|
|
|
BITS can be disabled, and that would kill your updates even though there is an internet connection. I'd just use a plain old WebRequest .. after asking the user whether he wants to apply the new updates, of course.
But that's just what I'd do
If you really really want to use BITS, there is a .NET wrapper[^] for it.
|
|
|
|
|
|
I have creted windows application in which I am showing data in one grid.This grid having 50000 lines. I want grid data to be exported to excel .
How do I expoert to excel from data grid view ?
Thanks In advance !!!!!!!!!
|
|
|
|
|
You export your data, the easiest way is to write a csv.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
A simple google search on c# to excel got over 10 million hits.
I assume therefore, that you have read all of the relevant ones, distilled their content and attempted the task yourself.
What have you tried so far?
Where did it go wrong?
Be precise, it's annoying to have to read through lots of irrelevant code.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
|
Hi,
as d@nish said you could use System.Data.OleDb but for faster and easier work you should use some 3rd party component like GemBox spreadsheet component
|
|
|
|
|
I got the solution
http://www.codeproject.com/KB/dotnet/ExportToExcel.aspx?
|
|
|
|
|
hi all friends.i want to give 70-526 certification.for that i need some tutorials & question,dumps.so pls send me dumps to animashniit@gmail.com.
pls add subject your mail when u send the file to me.
animash
|
|
|
|
|
Hi,
This is probably a good a starting place as any [^]
Hope that helps.
Alan.
|
|
|
|
|
Try here: Preparation guide for 70-526[^]
Plus, unless you REALLY like spam, don't post your email address...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
You know, any company worth working for, knows these things are useless and can quickly tell in interviews between programmers and people who got a certification by reading dumps
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Christian, I saw a number of your sayings against certification, as Raja collected them in his answer:
Certification on .Net Web/Windows application[^].
I want to say I could not agree more. This is wasteful, useless, but perhaps it's only useful as a little easy revenue generator for Microsoft. And a way of detection of lousy companies, those requiring or encouraging certifications for job candidates. And this is no so harmless, this is a kind of erosion of the idea of real education.
But my point is simpler than that. I think we should not answer all those questions on certifications posted on the Q&A forum, for example. We should focus more on computer science and software development. And certifications in no more than bureaucracy built around development.
—SASergey A Kryukov
|
|
|
|
|
hi all friends.i want to give 70-526 certification.for that i need some tutorials & question,dumps.so pls send me dumps to animashniit@gmail.com.
pls add subject your mail when u send the file to me.
animash
|
|
|
|
|
Hi guys.
I have some data and I'm going to generate a Graph with Crystal Report !
Could you guide me, how I can accomplish it ?
Thanks a lot.
|
|
|
|
|
Good Day!
I just have a problem that I would want to be addressed. This is with regards to using multiple webBrowser controls. As you can see, when I use multiple webBrowser controls, they tend to hang the application for a while.
I think this is a threading issue, but I am new to multithreading as well so I am looking for an easier way to fix this if possible. If not, please guide me on how I can fix this, so the webBrowser controls wont hang the application since it is important in my application to let the users manipulate the form while the webBrowser controls are running. Any ideas?
Any help will be greatly appreciated, thanx!
|
|
|
|