How to use IP addresses to populate a webbrowser control - vb.net

I have a listbox containing IP addresses - I want to select one from that list and load the corresponding web page. For some reason it doesn't treat the IP as a valid parameter.
' LBPrinters contains a list of IP addresses i.e. 192.168.101.45
Dim url As String = Trim(LBPrinters.SelectedItem.ToString)
Try
WebBrowser1.Navigate(url)
Catch
MessageBox.Show("Exception: Did not work")
End Try

Related

multiple recipients lotusscript send

On a domino-built website I have a button that runs a lotusscript agent. Part of this agent sends emails out. Below is summary code/snippet to give you the idea of what I am doing
(only relevant lines of code):
dim sendtoString as string
dim sendtoArray as variant
sendtoString = "mailaddress1,mailaddress2" '<----- two email addresses in a string
sendtoArray = split(sendtoString,|,|)
maildoc.sendto = sendtoArray
maildoc.save(true,true) '<--- so I can look at it as a saved document
'maildoc.send(false) '<----- NOTE as of right now I am not sending, choosing to simply look at the saved version until I get this right
The strange thing is TWO documents are SAVED. I have not enabled the "send" line yet because I do not want multiple emails to be sent from the code, instead hoping the router will do this for me.
Maybe the send is going to work fine, and individuals will NOT receive multiple emails (if six email addresses are in the original string, I dont want six emails landing in each person's inbox).....and maybe I need to use the "SaveMessageOnSend" property instead.
Anyone have any insight on what is going on here?
Using LotusScript, you can generate and send email messages. When creating the email message, recipient email addresses must be assigned to the SendTo field. To send an email to a single recipient, simply set the object value to a valid email address. For example:
doc.SendTo = "someone#ibm.com"
However, when sending email to multiple recipients, you must create an array of values and append the values to the SendTo, CopyTo, or BlindCopyTo field(s). This can be achieved by building either a static or dynamic array of values.
For a full answer you can find on this blog: https://flylib.com/books/en/2.348.1/sending_email_to_multiple_recipients_using_lotusscript.html

Getting an active IP address from a list of IP address in VB.net

I am stuck while getting ip4 address from my computer with 2 network card and 1 wifi card.
The code i am using to get IP address is this :
'Get Network Information
hostName = System.Net.Dns.GetHostName()
Dim hostEntry = Dns.GetHostEntry(hostName)
Dim addressList As New List(Of IPAddress)
For Each address In hostEntry.AddressList
If address.AddressFamily = Sockets.AddressFamily.InterNetwork Then
addressList.Add(address)
End If
Next
The problem is, if i used this code to get the ip address into a text box, it didn't always show the ip address my computer is currently active :
teIP4.Text = addressList(0).ToString
Edit : I am trying to connect to SQL Server via LAN but still in a and inserting my ip address to the database for further use, so i need to get the active ip address.
Is there anyway to specify which IP Address is currently active from code? Thanks!

EWS - Get current user (sender) contact information vb.net

I'm currently developping a program that will serve to send emails via company's EWS. the code for sending the message works perfectly but i also need to get some data about the sender of the email. It means, when a user sends the email to me, I need to see his position and address.
I'm struggling for more then a week to find a way to define the sender in the code and his contact details. And still nothing found so far.
Will appreacite your helf.
My code so far:
Dim url As String = "https://.../ews/Exchange.asmx"
exch.Url = New System.Uri(url)
exch.UseDefaultCredentials = False
exch.Credentials = New System.Net.NetworkCredential(TextBox2.Text, TextBox1.Text)
' exch.AutodiscoverUrl("myemail")
'exch.ResolveName("", ResolveNameSearchLocation.ContactsThenDirectory, True)
Dim message As New EmailMessage(exch)
message.Subject = "Новое заявление (АП) - " & ComboBox1.SelectedItem
message.Body = "Добрый день!" & vbNewLine & vbNewLine & "Прошу обработать заявление - " & ComboBox1.SelectedItem
For Each f In attfiles
message.Attachments.AddFileAttachment(f)
Next
message.ToRecipients.Add(email)
message.SendAndSaveCopy()
You are on the correct path by using the ResolveNames operation. Using the sender SMTP address, use ResolveNames to get back a list of potential matches for the sender. The foreach in the example is just so you can see each result. Since you are passing an SMTP address, it is very likely that your result set may be no more than a few contacts.
It sounds like one of your assumptions is that the sender always has an entry in the user's Contacts folder. Is that always true? Can the sender not exist as an entries in the recipients Contact folder but have an entry in Active Directory? You are doing the right thing to cover both possibilities by using the ResolveNameSearchLocation.ContactsThenDirectory option.
Resolve names works well if you have a display name or SMTP address. You also ask about how to find a specific contact. You mention that want to search the Contacts folder, but you are concerned about the number of employees. Do all employees have contact items in the target mailboxes? To search for specific contacts, learn about EWS search.

EWS error when trying to use .ResolveName

I have a vb.net application which uses EWS to send mail. The user account has no mailbox, but has permissions to send on behalf of another mailbox. Normally this code runs fine because it has the full email address to send to, however it fails when I try to find the address by resolving the name :
When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids.
The code is as follows :
Private Function ResolveName(ByVal Name As String) As String
Dim returnValue As NameResolutionCollection
returnValue = _MainService.ResolveName(Name)
Dim resolution As NameResolution
For Each resolution In returnValue
Return resolution.Mailbox.Address
Next
Call _Owner.LogThreadMessage(frmMain.ObjectTypes.Error, "Error resolving address", Name)
Return ""
End Function
I think somehow it is trying to use the user account to access an address book, rather than the mailbox.
Just incase anyone else runs into the same problem, I fixed this by looking in the directory only :
returnValue = _MainService.ResolveName(Name, ResolveNameSearchLocation.DirectoryOnly, True)
I think this is now looking at the global address list rather than in contacts, which doesn't exist.

Get certain text from a webpage [VB.NET]

What I'm looking to acquire is ip addresses from a webpage which contains the information.
Example page: http://www.game-monitor.com
I'm basically looking how to make vb.net visit that webpage and save the IP Addresses it gets from that webpage.
Thanks!
Check the System.Net.NetworkInformation for the Ping method. You can ping the hostname and return the IP to a variable.
Dim ping as Ping = New Ping()
Dim pingReply as PingReply = ping.send("www.game-monitor.com")
Dim ip as String = PingReply.Address.ToString()
Edit, you might want to add a try catch in case the ping doesn't get a reply.