Saturday, March 31, 2012

Sending/Receiving data from remote app

What is the best / easiest way to send small (<1Kb) data packets to a remote application (known IP address) from an ASP.NET driven web site? The remote app will then send a similar reply packet. It is not a database that is being accessed but a custom application that can be modified to receive and send this data.
Anyone done something similar?how is the remote app usually contacted. Does it send back a httpresponse. or is it some service that returns a stream of characters.
HTTPResponse object if it's replying in http
probably SOCKETS if it's returning data ( like telnet)
I have no experience doing this - but hope that points you in right direction

SendingEMail

I have an ASP.NET web app that I am trying to sens an email from. I use
the code below to send it.
mailMsg := MailMessage.Create;
mailMsg.From := self.Session['SMTPADDRESS'].ToString;
mailMsg.&To := aEMail;
mailMsg.BCC := aAdminEMail;
mailMsg.Subject := 'Your LoginID and Password';
mailMsg.BodyFormat := MailFormat.Text;
mailMsg.Body := 'Your LoginID is '''+aLogin+''' and Password
'''+aPassword+'''';
SmtpMail.SmtpServer := aSMTPServer;
SmtpMail.Send(mailMsg);
My mail server requires password authentication. Where do I assign the
password?
TIAThe following solution is officially unsupported - but it works (you
otherwise need to use CDO or something else to authenticate).
Add these lines to your code before you call SmtpMail.Send()
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthe
nticate",
"1"); //basic authentication
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusern
ame",
myLoginID); //set your username here
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassw
ord",
myPassword); //set your password here
-HTH
"gh" <gh@.at.ne> wrote in message
news:OFCyfZsjFHA.3012@.TK2MSFTNGP12.phx.gbl...
>I have an ASP.NET web app that I am trying to sens an email from. I use
>the code below to send it.
> mailMsg := MailMessage.Create;
> mailMsg.From := self.Session['SMTPADDRESS'].ToString;
> mailMsg.&To := aEMail;
> mailMsg.BCC := aAdminEMail;
> mailMsg.Subject := 'Your LoginID and Password';
> mailMsg.BodyFormat := MailFormat.Text;
> mailMsg.Body := 'Your LoginID is '''+aLogin+''' and Password
> '''+aPassword+'''';
> SmtpMail.SmtpServer := aSMTPServer;
> SmtpMail.Send(mailMsg);
> My mail server requires password authentication. Where do I assign the
> password?
> TIA
Check this out
http://www.systemwebmail.com/faq/3.8.aspx
info@.donotspam dowhileloop.com
http://www.dowhileloop.com -- Website Development
http://publicjoe.dowhileloop.com -- C# & VB.NET Tutorials
"gh" <gh@.at.ne> wrote in message
news:OFCyfZsjFHA.3012@.TK2MSFTNGP12.phx.gbl...
> I have an ASP.NET web app that I am trying to sens an email from. I use
> the code below to send it.
> mailMsg := MailMessage.Create;
> mailMsg.From := self.Session['SMTPADDRESS'].ToString;
> mailMsg.&To := aEMail;
> mailMsg.BCC := aAdminEMail;
> mailMsg.Subject := 'Your LoginID and Password';
> mailMsg.BodyFormat := MailFormat.Text;
> mailMsg.Body := 'Your LoginID is '''+aLogin+''' and Password
> '''+aPassword+'''';
> SmtpMail.SmtpServer := aSMTPServer;
> SmtpMail.Send(mailMsg);
> My mail server requires password authentication. Where do I assign the
> password?
> TIA

SendKeys

Hi,

I want to create a simle Exe Or Dll file which just execute some keys. I do not want to create a form. What kind of project I have to create?

Thanks
ShafiqConsole Application (creates an EXE without forms)

Sendkeys not declared?


I just downloaded ASP.Net Web Matrix and I'm really enjoying using it, even though I only know what I am doing about 10% of the time. The one problem I've encountered is that I can't get a VB "SendKeys" statement to work in an ASPX page. I have a really simple script written. Here it is:
Sub Button1_Click(sender As Object, e As EventArgs)
Shell ("notepad", 1)
SendKeys ("%", True)
End Sub
The button code is:
<form id="form1" runat="server">
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button>
</form>
When I run the page, it returns an error that states: "SendKeys statement not declared." Originally, I had no parentheses around "%, True," but ASP.NET demanded it so I put it in. Any help would be greatly appreciated. I am SendKeys-dependent.

Hi,

In .NET SendKey is a class declared in System.Windows.Forms namespace. You can use it as follows:

SendKeys.SendWait("%")

But... It is really not a good idea to open notepad at server from ASP.NET application. Is this what you intend to do?


Thank you so very much for your response. I am continuing to get the same error message, even after adaptation of the command to Sendkeys.Sendwait:

"Compiler Error Message:
BC30451: Name 'SendKeys' is not declared."

I had previously located Sendkeys as an identified namespace within System.Windows.Forms, but I am not sure what to do with that information beyond that. Is there something I need to do to get the page to "talk" with that class or namespace?

As for your caution, I appreciate it. Have read the warnings. The application is going to run only on my PC. Does that minimize the concern?
Again, thank you for your time.


Hi,
You have to reference System.Windows.Forms.dll to use this method.
I think what you want to do is to open notepad from client script and not from server side code. You can use scripting host to do it. In vbscript it will look like this:
Dim WshSHell
set WshShell = CreateObject("WScript.Shell")
WshShell.Run("notepad")
WScript.Sleep(100)
WshShell.AppActivate("Notepad")
WScript.Sleep(100)
WshShell.SendKeys("abc")

SendKeys In A Webform

I have a button to insert text into a field, after inserting the text i would like to set the cursor at the end of that text to then complete the entry
I can set the text and the focus
txtNewPrice.Text ="$"
txtNewPrice.Focus()

But how can i use the send keys to move to the end of that text
In a Windows world i would do this but i dont seem to have that function in the web world
SendKeys.Send("{END}")

you can try using javascript for that


Could you give me an example


Hi

I needed something similar this weekend. Found this and it works fine.

http://www.velocityreviews.com/forums/t70952-set-focus-and-cursor-at-end-of-text.html

SendMail ASP.NET 2.0: Multiple To's

Hello,
I am trying to send email to 4 people (str01 =
"p1.mysite.com,p2.mysite.com,p3.mysite.com") using the following:
Dim addrFrom As New MailAddress(str00)
Dim addrTo As New MailAddress(str01)
My problem is that only the first person receives the email. When I check
the variable addrTo the value is "p1.mysite.com". Any help with this would
be appreciated.
--
Thanks in advance,
sck10A mailAddress is used for a single person, the To property of the
MailMessage is actually a collection...
ur supposed to do:
myMessage.To.Add(new MailAddress("email1'))
myMessage.To.Add(new MailAddress("email2'))
myMessage.To.Add(new MailAddress("email3'))
Karl
http://www.openmymind.net/
http://www.fuelindustries.com/
"sck10" <sck10@.online.nospam> wrote in message
news:eyEDvZOWGHA.4924@.TK2MSFTNGP05.phx.gbl...
> Hello,
> I am trying to send email to 4 people (str01 =
> "p1.mysite.com,p2.mysite.com,p3.mysite.com") using the following:
> Dim addrFrom As New MailAddress(str00)
> Dim addrTo As New MailAddress(str01)
> My problem is that only the first person receives the email. When I check
> the variable addrTo the value is "p1.mysite.com". Any help with this
> would
> be appreciated.
> --
> Thanks in advance,
> sck10
>
Mail recipients can also be added using the cc and bcc attributes.
static void MultipleRecipients()
{
//create the mail message
MailMessage mail = new MailMessage();
//set the addresses
//to specify a friendly 'from' name, we use a different ctor
mail.From = new MailAddress("me@.company.com", "Me");
//since the To,Cc, and Bcc accept addresses,
//we can use the same technique as the From address
//since the To, Cc, and Bcc properties are collections,
//to add multiple addreses, we simply call .Add(...) multple times
mail.To.Add("you@.yourcompany.com");
mail.To.Add("you2@.yourcompany.com");
mail.CC.Add("cc1@.yourcompany.com");
mail.CC.Add("cc2@.yourcompany.com");
mail.Bcc.Add("blindcc1@.yourcompany.com");
mail.Bcc.Add("blindcc2@.yourcompany.com");
//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";
//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);
}
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Karl Seguin [MVP]" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net> wro
te in message
news:eN2MefOWGHA.924@.TK2MSFTNGP03.phx.gbl...
>A mailAddress is used for a single person, the To property of the MailMessa
ge is actually a
>collection...
> ur supposed to do:
> myMessage.To.Add(new MailAddress("email1'))
> myMessage.To.Add(new MailAddress("email2'))
> myMessage.To.Add(new MailAddress("email3'))
> Karl
> --
> http://www.openmymind.net/
> http://www.fuelindustries.com/
>
> "sck10" <sck10@.online.nospam> wrote in message news:eyEDvZOWGHA.4924@.TK2MS
FTNGP05.phx.gbl...
>
OT: Can you retrieve your email address from the smtp web.config?
"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:uFZL2pOWGHA.752@.TK2MSFTNGP02.phx.gbl...
> Mail recipients can also be added using the cc and bcc attributes.
> static void MultipleRecipients()
> {
> //create the mail message
> MailMessage mail = new MailMessage();
> //set the addresses
> //to specify a friendly 'from' name, we use a different ctor
> mail.From = new MailAddress("me@.company.com", "Me");
> //since the To,Cc, and Bcc accept addresses,
> //we can use the same technique as the From address
> //since the To, Cc, and Bcc properties are collections,
> //to add multiple addreses, we simply call .Add(...) multple times
> mail.To.Add("you@.yourcompany.com");
> mail.To.Add("you2@.yourcompany.com");
> mail.CC.Add("cc1@.yourcompany.com");
> mail.CC.Add("cc2@.yourcompany.com");
> mail.Bcc.Add("blindcc1@.yourcompany.com");
> mail.Bcc.Add("blindcc2@.yourcompany.com");
> //set the content
> mail.Subject = "This is an email";
> mail.Body = "this is the body content of the email.";
> //send the message
> SmtpClient smtp = new SmtpClient("127.0.0.1");
> smtp.Send(mail);
> }
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaol : http://asp.net.do/foros/
> ===================================
> "Karl Seguin [MVP]" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME
> net> wrote in message news:eN2MefOWGHA.924@.TK2MSFTNGP03.phx.gbl...
>
Hello, VickZaro.
The pattern to follow is this one :
<myGroup>
<nestedGroup>
<mySection>
<add key="key_one" value="1"/>
<add key="key_two" value="2"/>
</mySection>
</nestedGroup>
</myGroup>
</configuration>
You can read the value of the configuration section defined in the preceding
example as follows:
Dim config As NameValueCollection=ConfigurationSetting
s.GetConfig("myGroup/n
estedGroup/mySection")
Response.Write("The value of key_one is " & Server.HtmlEncode(config("key_on
e")) & "<br>")
Response.Write("The value of key_two is " & Server.HtmlEncode(config("key_tw
o")) )
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"VickZaro" <VickZaro2112@.hotmail.com> wrote in message
news:LzXYf.94692$6Q2.1609125@.weber.videotron.net...
> OT: Can you retrieve your email address from the smtp web.config?
> "Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
> news:uFZL2pOWGHA.752@.TK2MSFTNGP02.phx.gbl...
>

SendMail ASP.NET 2.0: Multiple Tos

Hello,

I am trying to send email to 4 people (str01 =
"p1.mysite.com,p2.mysite.com,p3.mysite.com") using the following:

Dim addrFrom As New MailAddress(str00)
Dim addrTo As New MailAddress(str01)

My problem is that only the first person receives the email. When I check
the variable addrTo the value is "p1.mysite.com". Any help with this would
be appreciated.
--
Thanks in advance,

sck10A mailAddress is used for a single person, the To property of the
MailMessage is actually a collection...

ur supposed to do:

myMessage.To.Add(new MailAddress("email1'))
myMessage.To.Add(new MailAddress("email2'))
myMessage.To.Add(new MailAddress("email3'))

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/

"sck10" <sck10@.online.nospam> wrote in message
news:eyEDvZOWGHA.4924@.TK2MSFTNGP05.phx.gbl...
> Hello,
> I am trying to send email to 4 people (str01 =
> "p1.mysite.com,p2.mysite.com,p3.mysite.com") using the following:
> Dim addrFrom As New MailAddress(str00)
> Dim addrTo As New MailAddress(str01)
> My problem is that only the first person receives the email. When I check
> the variable addrTo the value is "p1.mysite.com". Any help with this
> would
> be appreciated.
> --
> Thanks in advance,
> sck10
Mail recipients can also be added using the cc and bcc attributes.

static void MultipleRecipients()
{
//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
//to specify a friendly 'from' name, we use a different ctor
mail.From = new MailAddress("me@.company.com", "Me");

//since the To,Cc, and Bcc accept addresses,
//we can use the same technique as the From address
//since the To, Cc, and Bcc properties are collections,
//to add multiple addreses, we simply call .Add(...) multple times

mail.To.Add("you@.yourcompany.com");
mail.To.Add("you2@.yourcompany.com");
mail.CC.Add("cc1@.yourcompany.com");
mail.CC.Add("cc2@.yourcompany.com");
mail.Bcc.Add("blindcc1@.yourcompany.com");
mail.Bcc.Add("blindcc2@.yourcompany.com");

//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";

//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);
}

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Karl Seguin [MVP]" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message
news:eN2MefOWGHA.924@.TK2MSFTNGP03.phx.gbl...
>A mailAddress is used for a single person, the To property of the MailMessage is actually a
>collection...
> ur supposed to do:
> myMessage.To.Add(new MailAddress("email1'))
> myMessage.To.Add(new MailAddress("email2'))
> myMessage.To.Add(new MailAddress("email3'))
> Karl
> --
> http://www.openmymind.net/
> http://www.fuelindustries.com/
>
> "sck10" <sck10@.online.nospam> wrote in message news:eyEDvZOWGHA.4924@.TK2MSFTNGP05.phx.gbl...
>> Hello,
>>
>> I am trying to send email to 4 people (str01 =
>> "p1.mysite.com,p2.mysite.com,p3.mysite.com") using the following:
>>
>> Dim addrFrom As New MailAddress(str00)
>> Dim addrTo As New MailAddress(str01)
>>
>> My problem is that only the first person receives the email. When I check
>> the variable addrTo the value is "p1.mysite.com". Any help with this would
>> be appreciated.
>> --
>> Thanks in advance,
>>
>> sck10
>>
>>
OT: Can you retrieve your email address from the smtp web.config?

"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:uFZL2pOWGHA.752@.TK2MSFTNGP02.phx.gbl...
> Mail recipients can also be added using the cc and bcc attributes.
> static void MultipleRecipients()
> {
> //create the mail message
> MailMessage mail = new MailMessage();
> //set the addresses
> //to specify a friendly 'from' name, we use a different ctor
> mail.From = new MailAddress("me@.company.com", "Me");
> //since the To,Cc, and Bcc accept addresses,
> //we can use the same technique as the From address
> //since the To, Cc, and Bcc properties are collections,
> //to add multiple addreses, we simply call .Add(...) multple times
> mail.To.Add("you@.yourcompany.com");
> mail.To.Add("you2@.yourcompany.com");
> mail.CC.Add("cc1@.yourcompany.com");
> mail.CC.Add("cc2@.yourcompany.com");
> mail.Bcc.Add("blindcc1@.yourcompany.com");
> mail.Bcc.Add("blindcc2@.yourcompany.com");
> //set the content
> mail.Subject = "This is an email";
> mail.Body = "this is the body content of the email.";
> //send the message
> SmtpClient smtp = new SmtpClient("127.0.0.1");
> smtp.Send(mail);
> }
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaol : http://asp.net.do/foros/
> ===================================
> "Karl Seguin [MVP]" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME
> net> wrote in message news:eN2MefOWGHA.924@.TK2MSFTNGP03.phx.gbl...
>>A mailAddress is used for a single person, the To property of the
>>MailMessage is actually a collection...
>>
>> ur supposed to do:
>>
>> myMessage.To.Add(new MailAddress("email1'))
>> myMessage.To.Add(new MailAddress("email2'))
>> myMessage.To.Add(new MailAddress("email3'))
>>
>> Karl
>>
>> --
>> http://www.openmymind.net/
>> http://www.fuelindustries.com/
>>
>>
>> "sck10" <sck10@.online.nospam> wrote in message
>> news:eyEDvZOWGHA.4924@.TK2MSFTNGP05.phx.gbl...
>>> Hello,
>>>
>>> I am trying to send email to 4 people (str01 =
>>> "p1.mysite.com,p2.mysite.com,p3.mysite.com") using the following:
>>>
>>> Dim addrFrom As New MailAddress(str00)
>>> Dim addrTo As New MailAddress(str01)
>>>
>>> My problem is that only the first person receives the email. When I
>>> check
>>> the variable addrTo the value is "p1.mysite.com". Any help with this
>>> would
>>> be appreciated.
>>> --
>>> Thanks in advance,
>>>
>>> sck10
>>>
>>>
>>
>>
Hello, VickZaro.

The pattern to follow is this one :

<myGroup>
<nestedGroup>
<mySection>
<add key="key_one" value="1"/>
<add key="key_two" value="2"/>
</mySection>
</nestedGroup>
</myGroup>
</configuration
You can read the value of the configuration section defined in the preceding example as follows:

Dim config As NameValueCollection=ConfigurationSettings.GetConfi g("myGroup/nestedGroup/mySection")
Response.Write("The value of key_one is " & Server.HtmlEncode(config("key_one")) & "<br>")
Response.Write("The value of key_two is " & Server.HtmlEncode(config("key_two")) )

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"VickZaro" <VickZaro2112@.hotmail.com> wrote in message
news:LzXYf.94692$6Q2.1609125@.weber.videotron.net.. .
> OT: Can you retrieve your email address from the smtp web.config?
> "Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
> news:uFZL2pOWGHA.752@.TK2MSFTNGP02.phx.gbl...
>> Mail recipients can also be added using the cc and bcc attributes.
>>
>> static void MultipleRecipients()
>> {
>> //create the mail message
>> MailMessage mail = new MailMessage();
>>
>> //set the addresses
>> //to specify a friendly 'from' name, we use a different ctor
>> mail.From = new MailAddress("me@.company.com", "Me");
>>
>> //since the To,Cc, and Bcc accept addresses,
>> //we can use the same technique as the From address
>> //since the To, Cc, and Bcc properties are collections,
>> //to add multiple addreses, we simply call .Add(...) multple times
>>
>> mail.To.Add("you@.yourcompany.com");
>> mail.To.Add("you2@.yourcompany.com");
>> mail.CC.Add("cc1@.yourcompany.com");
>> mail.CC.Add("cc2@.yourcompany.com");
>> mail.Bcc.Add("blindcc1@.yourcompany.com");
>> mail.Bcc.Add("blindcc2@.yourcompany.com");
>>
>> //set the content
>> mail.Subject = "This is an email";
>> mail.Body = "this is the body content of the email.";
>>
>> //send the message
>> SmtpClient smtp = new SmtpClient("127.0.0.1");
>> smtp.Send(mail);
>> }
>>
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espaol : http://asp.net.do/foros/
>> ===================================
>> "Karl Seguin [MVP]" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message
>> news:eN2MefOWGHA.924@.TK2MSFTNGP03.phx.gbl...
>>>A mailAddress is used for a single person, the To property of the MailMessage is actually a
>>>collection...
>>>
>>> ur supposed to do:
>>>
>>> myMessage.To.Add(new MailAddress("email1'))
>>> myMessage.To.Add(new MailAddress("email2'))
>>> myMessage.To.Add(new MailAddress("email3'))
>>>
>>> Karl
>>>
>>> --
>>> http://www.openmymind.net/
>>> http://www.fuelindustries.com/
>>>
>>>
>>> "sck10" <sck10@.online.nospam> wrote in message news:eyEDvZOWGHA.4924@.TK2MSFTNGP05.phx.gbl...
>>>> Hello,
>>>>
>>>> I am trying to send email to 4 people (str01 =
>>>> "p1.mysite.com,p2.mysite.com,p3.mysite.com") using the following:
>>>>
>>>> Dim addrFrom As New MailAddress(str00)
>>>> Dim addrTo As New MailAddress(str01)
>>>>
>>>> My problem is that only the first person receives the email. When I check
>>>> the variable addrTo the value is "p1.mysite.com". Any help with this would
>>>> be appreciated.
>>>> --
>>>> Thanks in advance,
>>>>
>>>> sck10
>>>>
>>>>
>>>
>>>
>>
>>