Find a specific string from Online Text File? - vb.net

I've heard much about you guys, I'm about to finish my application but I need to finish my login system.
I've created a notepad & uploaded it to the server with the following examples:
Username:TestUser1
Password:TestPass1
License:28/06/2013
Username:TestUser2
Password:TestPass2
License:30/06/2013
I already made a login form with a Textbox1, Textbox2 & a Button.
Textbox1 = InputUser
Textbox2 = InputPass
Button1 = Login
I want that if the button is pressed it checks the username & password matches then login with a messagebox which says: "your license is valid until: " & License.
Also, I want that every username got a password, so other users can't use other's passwords.
How can I write this code in VB.net 2010?
Thanks in advance.

Does it bother you that it takes 10 minutes to crack an authentication system like this? Not only that, but all your users and passwords will be visible to the public for anyone who knows the address (which is easy to find using just a packet analyzer).
If the answer is still no, take a look at how to use WebRequest and WebResponse to retrieve your text file: http://msdn.microsoft.com/en-us/library/456dfw4f.aspx.
PS: stackoverflow is here to solve problems in your existing code, not to write the code for you.

Someone have this for you ...
Do that with HttpWebRequest and its GetResponse method, which gives you a WebResponse on which you can call GetResponseStream to get a Stream object to pass to your StreamReader.

Related

pass value to a web browser and print it in a particular textbox

I have a win-form application that generates passwords that I would like to send directly over to a web page textbox like input as apart of a new user sign up. I found a similair question. (Fill Form C# & Post Error) But I dont think I am after the same goal. Is it possible to do this without using a macro or manually copy n pasting? The above post is in C# however I will ever using vb. If there is a answer on here please link, but I have gone through the forum.

How to submit error reports to developer?

How can I submit error reports to the developer (me) when coding in VB.NET?
I have made a Google Forms response form here. Is it possible to use the WebBrowser Control functions to paste a string into the TextBox in there and then click the button to submit it, all automatically?
Would it be better to use a different submission form service than this? I know that it uses complicated JavaScript to code everything. If it would be better to use a custom HTML website, how would you interact with that (I can probably figure out how to code the HTML itself)?
All help welcome!
OK, this was my solution: use System.Net.Mail and MailMessage and SMTP Credentials to send an email to the developer.

Writing form details to a text file in Windows Phone

I am creating a Windows Phone App using VB.NET and what I want to do is have the user fill out a form within the app, and then when they press a send button I need to app to write these details to a text file, so I can then attach this to an email.
However the problem is I have no idea how to successfully write these details to a text file, I was wondering if anybody had an example of how it is done or just some advice that may help me to find what path I need to take in order to resolve this?
Thank you
The simplest way to send an email on Windows Phone is via the EmailComposeTask API.
Sample VB.NET code from MSDN:
Dim emailComposeTask as EmailComposeTask= new EmailComposeTask()
emailComposeTask.Subject = "message subject"
emailComposeTask.Body = "message body"
emailComposeTask.To = "recipient#example.com"
emailComposeTask.Cc = "cc#example.com"
emailComposeTask.Bcc = "bcc#example.com"
emailComposeTask.Show()
The downside of this API is that it doesn't allow attaching files.
So if you have the requirement to send the email with an attachment, you'll have to rely on an external service.
Here is the code for creating a text file in a MemoryStream:
Dim memoryStrm As New MemoryStream()
Dim writer As New StreamWriter(memoryStrm)
writer.WriteLine("Line 1")
writer.WriteLine("Line 2")
You could send this file to a web service that will in turn send the email.

automatically log in to windows security form using vb dotnet

I am trying to build an application using VB .Net that will automatically log into ADP so that I can automatically download a time card report. I tried to show an image, but because I am new I am unable. You can view the form by going to https://portal.adp.com/public/index.htm and clicking User Login. Can someone tell me how to populate the User name and Password text boxes? I have spent a lot of time searching, but haven't been unable to find any information on this. Any help is greatly appreciated.
If you are using a WebClient to interact with the site, you can simply use the Credentials property because this is a standard HTTP-login.
Dim client As New WebClient()
client.Credentials = new NetworkCredential("username", "password")
Dim pageData As String = client.DownloadString("https://portal.adp.com/wps/employee/employee.jsp")
Here more information about the NetworkCredential class. Also you can take a look at this. If you are using a WebBrowser control, you can use this method.
You can create an Internet Explorer add-in, and use that to fill in the form and login. Here is a tutorial I found.
http://www.add-in-express.com/creating-addins-blog/2012/07/09/create-addons-ie10/

Clearing text fields on vb.net project vs2008

Summary: web page has a few fields to allow the user to enter payments. After the system processes the payments, the fields weren't cleared out. So my task is to simply clear them out. This is the few lines of code:
' first insert the transaction
InsertANewTransaction()
'clear out the values
txtAddTransAmount.Text = ""
ddlAddTransTypes.SelectedIndex = -1
txtComment.Text = ""
' then create and print the receipt
Payment2MsWordDoc(Payment, PaymentType, PreviousBalance, NewBalance, DueDate, ProjMinPayment)
I added the three lines in the middle resetting the values. Problem is, they don't reset. Doing some debugging the file lines of the Payment2MsWordDoc procedure are the culprit:
Response.AppendHeader("Content-Type", "application/msword")
Response.AppendHeader("Content-disposition", "attachment; filename=" + fileName)
Response.Write(strBody)
The procedure is writing an HTML receipt into the strBody and displaying it to the user. They see the 'File download, do you want to open or save this file....' and can open the receipt in ms-word. Without those three lines, the resetting works. So clearly they are messing up something, I just don't understand what.
I've got a workaround, but I'd like to know what is going on. Even to the tune of is this a correct way of creating/downloading a document. This in an inherited system, the original designer is long gone. I'm not strong in either VB or web apps so am clueless as to what the problem is.
Imagine you have a textarea on a webpage and then a regular hyperlink to a word document below that. If you type into the textarea and then click the link, do you expect the textarea to clear out? No, the browser will just launch the word document and leave the page as is. The same thing is happening with your form. Upon submit, the server is just sending a word document and since the server hasn't sent any new HTML the browser just stays as is. All of your clearing out of textfields doesn't matter because the new state is never sent down the wire. What you need to do is to send the browser new HTML and not the word doc. In the new HTML you can include a meta redirect to the word doc or better yet a download link.