Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Wednesday, March 28, 2012

System.IO.Ports.SerialPort

is there a way to embed the System.IO.Ports.SerialPort object in my html . s
o
that the client can access to a device connected to his SerialCOM ?
i tried to wrap the System.IO.Ports.SerialPort in my own component and then
put it in <object> but it doesnt seem to work, any suggestions?I doubt the security sandbox of the user's browser would allow such a thing.
You'll probably need a thick client such as an ActiveX control or Windows
Forms application.
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
news:1F4238ED-0121-482A-9359-10B1F0593C8C@.microsoft.com...
> is there a way to embed the System.IO.Ports.SerialPort object in my html .
> so
> that the client can access to a device connected to his SerialCOM ?
> i tried to wrap the System.IO.Ports.SerialPort in my own component and
> then
> put it in <object> but it doesnt seem to work, any suggestions?
You can run .NET components on the client side browser provided that your
client has the .NET framework installed and willing to allow you to do so.
SA
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:eK0s3eQdGHA.3888@.TK2MSFTNGP02.phx.gbl...
>I doubt the security sandbox of the user's browser would allow such a
>thing.
> You'll probably need a thick client such as an ActiveX control or Windows
> Forms application.
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
> news:1F4238ED-0121-482A-9359-10B1F0593C8C@.microsoft.com...
>
but the standard .net seetings would not allow the component to access
serial ports. the users will have to authorize your component to do this
using the caspol.exe utility.
-- bruce (sqlwork.com)
"MSDN" <sql_agentman@.hotmail.com> wrote in message
news:e4%2340ARdGHA.3888@.TK2MSFTNGP02.phx.gbl...
> You can run .NET components on the client side browser provided that your
> client has the .NET framework installed and willing to allow you to do so.
> SA
> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
> news:eK0s3eQdGHA.3888@.TK2MSFTNGP02.phx.gbl...
>
Yes some security has to be set properly. I would use this in Intranet or
Wide-Intranet-Corp situations.
SA
"bruce barker (sqlwork.com)" <b_r_u_c_e_removeunderscores@.sqlwork.com> wrote
in message news:eWT40VRdGHA.4128@.TK2MSFTNGP05.phx.gbl...
> but the standard .net seetings would not allow the component to access
> serial ports. the users will have to authorize your component to do this
> using the caspol.exe utility.
> -- bruce (sqlwork.com)
> "MSDN" <sql_agentman@.hotmail.com> wrote in message
> news:e4%2340ARdGHA.3888@.TK2MSFTNGP02.phx.gbl...
>
so what do i need to write inside my <object> tag? what is the classid for
SerialPort?
"MSDN" wrote:

> Yes some security has to be set properly. I would use this in Intranet or
> Wide-Intranet-Corp situations.
> SA
>
> "bruce barker (sqlwork.com)" <b_r_u_c_e_removeunderscores@.sqlwork.com> wro
te
> in message news:eWT40VRdGHA.4128@.TK2MSFTNGP05.phx.gbl...
>
>
Read this that might help you out.
http://msdn.microsoft.com/msdnmag/i...02/01/UserCtrl/
SA
"Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
news:7C59DB6A-82AE-41B6-ACCB-936BC5723A66@.microsoft.com...
> so what do i need to write inside my <object> tag? what is the classid for
> SerialPort?
> "MSDN" wrote:
>
i read the article and followed all the steps but the it doesnt work, im
using VS 2005 and the artitcle was in 2002 so maybe the project upgrade
ruined something. any way i still cant create the control i need, any
suggestions?
"MSDN" wrote:

> Read this that might help you out.
> http://msdn.microsoft.com/msdnmag/i...02/01/UserCtrl/
> SA
> "Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
> news:7C59DB6A-82AE-41B6-ACCB-936BC5723A66@.microsoft.com...
>
>

System.IO.Ports.SerialPort

is there a way to embed the System.IO.Ports.SerialPort object in my html . so
that the client can access to a device connected to his SerialCOM ?

i tried to wrap the System.IO.Ports.SerialPort in my own component and then
put it in <object> but it doesnt seem to work, any suggestions?I doubt the security sandbox of the user's browser would allow such a thing.
You'll probably need a thick client such as an ActiveX control or Windows
Forms application.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
news:1F4238ED-0121-482A-9359-10B1F0593C8C@.microsoft.com...
> is there a way to embed the System.IO.Ports.SerialPort object in my html .
> so
> that the client can access to a device connected to his SerialCOM ?
> i tried to wrap the System.IO.Ports.SerialPort in my own component and
> then
> put it in <object> but it doesnt seem to work, any suggestions?
You can run .NET components on the client side browser provided that your
client has the .NET framework installed and willing to allow you to do so.

SA

"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:eK0s3eQdGHA.3888@.TK2MSFTNGP02.phx.gbl...
>I doubt the security sandbox of the user's browser would allow such a
>thing.
> You'll probably need a thick client such as an ActiveX control or Windows
> Forms application.
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
> news:1F4238ED-0121-482A-9359-10B1F0593C8C@.microsoft.com...
>> is there a way to embed the System.IO.Ports.SerialPort object in my html
>> . so
>> that the client can access to a device connected to his SerialCOM ?
>>
>> i tried to wrap the System.IO.Ports.SerialPort in my own component and
>> then
>> put it in <object> but it doesnt seem to work, any suggestions?
but the standard .net seetings would not allow the component to access
serial ports. the users will have to authorize your component to do this
using the caspol.exe utility.

-- bruce (sqlwork.com)

"MSDN" <sql_agentman@.hotmail.com> wrote in message
news:e4%2340ARdGHA.3888@.TK2MSFTNGP02.phx.gbl...
> You can run .NET components on the client side browser provided that your
> client has the .NET framework installed and willing to allow you to do so.
> SA
> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
> news:eK0s3eQdGHA.3888@.TK2MSFTNGP02.phx.gbl...
>>I doubt the security sandbox of the user's browser would allow such a
>>thing.
>> You'll probably need a thick client such as an ActiveX control or Windows
>> Forms application.
>>
>> --
>> I hope this helps,
>> Steve C. Orr, MCSD, MVP
>> http://SteveOrr.net
>>
>>
>> "Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
>> news:1F4238ED-0121-482A-9359-10B1F0593C8C@.microsoft.com...
>>> is there a way to embed the System.IO.Ports.SerialPort object in my html
>>> . so
>>> that the client can access to a device connected to his SerialCOM ?
>>>
>>> i tried to wrap the System.IO.Ports.SerialPort in my own component and
>>> then
>>> put it in <object> but it doesnt seem to work, any suggestions?
>>
>>
Yes some security has to be set properly. I would use this in Intranet or
Wide-Intranet-Corp situations.

SA

"bruce barker (sqlwork.com)" <b_r_u_c_e_removeunderscores@.sqlwork.com> wrote
in message news:eWT40VRdGHA.4128@.TK2MSFTNGP05.phx.gbl...
> but the standard .net seetings would not allow the component to access
> serial ports. the users will have to authorize your component to do this
> using the caspol.exe utility.
> -- bruce (sqlwork.com)
> "MSDN" <sql_agentman@.hotmail.com> wrote in message
> news:e4%2340ARdGHA.3888@.TK2MSFTNGP02.phx.gbl...
>>
>> You can run .NET components on the client side browser provided that your
>> client has the .NET framework installed and willing to allow you to do
>> so.
>>
>> SA
>>
>> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
>> news:eK0s3eQdGHA.3888@.TK2MSFTNGP02.phx.gbl...
>>>I doubt the security sandbox of the user's browser would allow such a
>>>thing.
>>> You'll probably need a thick client such as an ActiveX control or
>>> Windows Forms application.
>>>
>>> --
>>> I hope this helps,
>>> Steve C. Orr, MCSD, MVP
>>> http://SteveOrr.net
>>>
>>>
>>> "Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
>>> news:1F4238ED-0121-482A-9359-10B1F0593C8C@.microsoft.com...
>>>> is there a way to embed the System.IO.Ports.SerialPort object in my
>>>> html . so
>>>> that the client can access to a device connected to his SerialCOM ?
>>>>
>>>> i tried to wrap the System.IO.Ports.SerialPort in my own component and
>>>> then
>>>> put it in <object> but it doesnt seem to work, any suggestions?
>>>
>>>
>>
>>
so what do i need to write inside my <object> tag? what is the classid for
SerialPort?

"MSDN" wrote:

> Yes some security has to be set properly. I would use this in Intranet or
> Wide-Intranet-Corp situations.
> SA
>
> "bruce barker (sqlwork.com)" <b_r_u_c_e_removeunderscores@.sqlwork.com> wrote
> in message news:eWT40VRdGHA.4128@.TK2MSFTNGP05.phx.gbl...
> > but the standard .net seetings would not allow the component to access
> > serial ports. the users will have to authorize your component to do this
> > using the caspol.exe utility.
> > -- bruce (sqlwork.com)
> > "MSDN" <sql_agentman@.hotmail.com> wrote in message
> > news:e4%2340ARdGHA.3888@.TK2MSFTNGP02.phx.gbl...
> >>
> >> You can run .NET components on the client side browser provided that your
> >> client has the .NET framework installed and willing to allow you to do
> >> so.
> >>
> >> SA
> >>
> >> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
> >> news:eK0s3eQdGHA.3888@.TK2MSFTNGP02.phx.gbl...
> >>>I doubt the security sandbox of the user's browser would allow such a
> >>>thing.
> >>> You'll probably need a thick client such as an ActiveX control or
> >>> Windows Forms application.
> >>>
> >>> --
> >>> I hope this helps,
> >>> Steve C. Orr, MCSD, MVP
> >>> http://SteveOrr.net
> >>>
> >>>
> >>> "Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
> >>> news:1F4238ED-0121-482A-9359-10B1F0593C8C@.microsoft.com...
> >>>> is there a way to embed the System.IO.Ports.SerialPort object in my
> >>>> html . so
> >>>> that the client can access to a device connected to his SerialCOM ?
> >>>>
> >>>> i tried to wrap the System.IO.Ports.SerialPort in my own component and
> >>>> then
> >>>> put it in <object> but it doesnt seem to work, any suggestions?
> >>>
> >>>
> >>
> >>
>
Read this that might help you out.

http://msdn.microsoft.com/msdnmag/i...02/01/UserCtrl/

SA

"Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
news:7C59DB6A-82AE-41B6-ACCB-936BC5723A66@.microsoft.com...
> so what do i need to write inside my <object> tag? what is the classid for
> SerialPort?
> "MSDN" wrote:
>> Yes some security has to be set properly. I would use this in Intranet
>> or
>> Wide-Intranet-Corp situations.
>>
>> SA
>>
>>
>> "bruce barker (sqlwork.com)" <b_r_u_c_e_removeunderscores@.sqlwork.com>
>> wrote
>> in message news:eWT40VRdGHA.4128@.TK2MSFTNGP05.phx.gbl...
>> > but the standard .net seetings would not allow the component to access
>> > serial ports. the users will have to authorize your component to do
>> > this
>> > using the caspol.exe utility.
>>> > -- bruce (sqlwork.com)
>>> > "MSDN" <sql_agentman@.hotmail.com> wrote in message
>> > news:e4%2340ARdGHA.3888@.TK2MSFTNGP02.phx.gbl...
>> >>
>> >> You can run .NET components on the client side browser provided that
>> >> your
>> >> client has the .NET framework installed and willing to allow you to do
>> >> so.
>> >>
>> >> SA
>> >>
>> >> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
>> >> news:eK0s3eQdGHA.3888@.TK2MSFTNGP02.phx.gbl...
>> >>>I doubt the security sandbox of the user's browser would allow such a
>> >>>thing.
>> >>> You'll probably need a thick client such as an ActiveX control or
>> >>> Windows Forms application.
>> >>>
>> >>> --
>> >>> I hope this helps,
>> >>> Steve C. Orr, MCSD, MVP
>> >>> http://SteveOrr.net
>> >>>
>> >>>
>> >>> "Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
>> >>> news:1F4238ED-0121-482A-9359-10B1F0593C8C@.microsoft.com...
>> >>>> is there a way to embed the System.IO.Ports.SerialPort object in my
>> >>>> html . so
>> >>>> that the client can access to a device connected to his SerialCOM ?
>> >>>>
>> >>>> i tried to wrap the System.IO.Ports.SerialPort in my own component
>> >>>> and
>> >>>> then
>> >>>> put it in <object> but it doesnt seem to work, any suggestions?
>> >>>
>> >>>
>> >>
>> >>
>>>>
>>
>
i read the article and followed all the steps but the it doesnt work, im
using VS 2005 and the artitcle was in 2002 so maybe the project upgrade
ruined something. any way i still cant create the control i need, any
suggestions?

"MSDN" wrote:

> Read this that might help you out.
> http://msdn.microsoft.com/msdnmag/i...02/01/UserCtrl/
> SA
> "Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
> news:7C59DB6A-82AE-41B6-ACCB-936BC5723A66@.microsoft.com...
> > so what do i need to write inside my <object> tag? what is the classid for
> > SerialPort?
> > "MSDN" wrote:
> >> Yes some security has to be set properly. I would use this in Intranet
> >> or
> >> Wide-Intranet-Corp situations.
> >>
> >> SA
> >>
> >>
> >> "bruce barker (sqlwork.com)" <b_r_u_c_e_removeunderscores@.sqlwork.com>
> >> wrote
> >> in message news:eWT40VRdGHA.4128@.TK2MSFTNGP05.phx.gbl...
> >> > but the standard .net seetings would not allow the component to access
> >> > serial ports. the users will have to authorize your component to do
> >> > this
> >> > using the caspol.exe utility.
> >> >> > -- bruce (sqlwork.com)
> >> >> > "MSDN" <sql_agentman@.hotmail.com> wrote in message
> >> > news:e4%2340ARdGHA.3888@.TK2MSFTNGP02.phx.gbl...
> >> >>
> >> >> You can run .NET components on the client side browser provided that
> >> >> your
> >> >> client has the .NET framework installed and willing to allow you to do
> >> >> so.
> >> >>
> >> >> SA
> >> >>
> >> >> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
> >> >> news:eK0s3eQdGHA.3888@.TK2MSFTNGP02.phx.gbl...
> >> >>>I doubt the security sandbox of the user's browser would allow such a
> >> >>>thing.
> >> >>> You'll probably need a thick client such as an ActiveX control or
> >> >>> Windows Forms application.
> >> >>>
> >> >>> --
> >> >>> I hope this helps,
> >> >>> Steve C. Orr, MCSD, MVP
> >> >>> http://SteveOrr.net
> >> >>>
> >> >>>
> >> >>> "Tamir.D" <Tamir.D@.discussions.microsoft.com> wrote in message
> >> >>> news:1F4238ED-0121-482A-9359-10B1F0593C8C@.microsoft.com...
> >> >>>> is there a way to embed the System.IO.Ports.SerialPort object in my
> >> >>>> html . so
> >> >>>> that the client can access to a device connected to his SerialCOM ?
> >> >>>>
> >> >>>> i tried to wrap the System.IO.Ports.SerialPort in my own component
> >> >>>> and
> >> >>>> then
> >> >>>> put it in <object> but it doesnt seem to work, any suggestions?
> >> >>>
> >> >>>
> >> >>
> >> >>
> >> >> >>
> >>
> >>
>

Monday, March 26, 2012

System.Net.Mail class smtpdemo needs users address in message body from txt.emailAddress

I have this code behind from the new asp.net 2.0 System.Net.Mail class smtpdemo i am working with. It sends an HTML email to myself the from address and to the email address in txt.emailAddress as a CC. I am trying to get the txt.email address somewhere in the message body that it sends out. this code does not show the imputed contents of txt.emailaddress anywhere in the email so i canot reply to the sender. It declaires me as the sender and sends the person filing out the form an email. I need to declar the contents of txt.emailadress as a variable and call it in the message body. Ive tryed dozens of different ways but they all have errors. i hope someone can look at this code and show me how to get the users email address sent with the message.
/code/
Imports System.Net.Mail

PartialClass report_aspx

Inherits System.Web.UI.Page

ProtectedSub sendEmail_Click(ByVal senderAsObject,ByVal e _

As System.EventArgs)Handles sendEmail.Click

Dim sBodyAsString

Dim fileReaderBodyAsString

Dim fileReaderFormatAsString

Dim WebDirectoryAsString = Server.MapPath(".") &"\"

Dim fileNameAsString = WebDirectory

Dim htmlEmailFormatAsString = WebDirectory &"MailFormat.htm"

SelectCase Subject.Text

Case"Broken Link"

fileName = fileName &"BrokenLink.txt"

Case"Missing Picture"

fileName = fileName &"MissingPicture.txt"

Case"Typographical Error"

fileName = fileName &"TypoError.txt"

CaseElse

fileName = fileName &"other.txt"

EndSelect

fileReaderBody =My.Computer.FileSystem.ReadAllText(fileName)

fileReaderFormat =My.Computer.FileSystem.ReadAllText(htmlEmailFormat)

sBody = fileReaderFormat.Replace("BODYGOESHERE", _

messageBody.Text)

sBody = sBody.Replace("CONTENTGOESHERE", fileReaderBody)

sBody = sBody.Replace("SUBJECTGOESHERE", Subject.Text)

Dim toAddressAs MailAddress =New _

MailAddress(me@dotnet.itags.org.myemailaddress,"Webmaster")

Dim ccAddressAs MailAddress =New _

MailAddress(emailAddress.Text, emailName.Text)

Dim SenderAddressAs MailAddress =New _

MailAddress(emailAddress.Text)

Dim fromAddressAs MailAddress =New _

MailAddress(me@dotnet.itags.org.myemailaddress)

Dim eMailAs MailMessage =New _

MailMessage(fromAddress, fromAddress)

eMail.CC.Add(fromAddress)

eMail.Subject = Subject.Text

Dim htmlTypeAs System.Net.Mime.ContentType = _

New System.Net.Mime.ContentType("text/html")

Dim txtTypeAs System.Net.Mime.ContentType = _

New System.Net.Mime.ContentType("text/plain")

eMail.AlternateViews.Add( _

AlternateView.CreateAlternateViewFromString(sBody, htmlType))

eMail.AlternateViews.Add( _

AlternateView.CreateAlternateViewFromString(fileReaderBody & vbCrLf & messageBody.Text, htmlType))

Dim attchmentAs Attachment =New _

Attachment(WebDirectory &"goldbar.gif")

eMail.Attachments.Add(attchment)

Dim clientAs SmtpClient =New SmtpClient("myemailserver")

client.Send(eMail)

lblMessageSent.Text ="MESSAGE SENT"

emailAddress.Text =""

emailName.Text =""

messageBody.Text =""

EndSub

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

EndSub

EndClass
/end code/

I fixed my form by modifying the mailformat.htm page that I will place below and adding:

/codebehind file/
Body = sBody.Replace("NAMEGOESHERE", emailName.Text)

sBody = sBody.Replace("EMAILFROMGOESHERE", emailAddress.Text)
/end codebehind file/
/mailformat.html/

<html><body><h1>SUBJECTGOESHERE</h1><imgsrc="goldbar.gif"/><br/>BODYGOESHERE

<br/>

<imgsrc="goldbar.gif"/><br/>

NAMEGOESHERE<br/>

EMAILFROMGOESHERE<br/>

<br/>

<blockquote>CONTENTGOESHERE</blockquote></body></html>

System.Net.Mail issue - html AlternateView losing period in href

I have setup some code that grabs HTML from our database and attaches it as an AlternateView
--
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlSB.ToString(),Encoding.GetEncoding(0),MediaTypeNames.Text.Html);
--
I am dumping it to a text file locally. In the instance where there is a wrap in the body which contains an a href, and there is a period just AFTER the wrap, it drops the period
ex of the physical email file:
blah blah blah blah <a href="http://links.10026.com/?link=http://forums.asp=
.net>Asp Forums</a>blah blah blah blah bla=
(note the period on the new line)
shows up as -
blah blah blah blah <a href="http://links.10026.com/?link=http://forums.aspnet>Asp Forums</a>blah blah blah blah bla
(note the missing period between asp and net)
Any ideas?
thanks
m

Since I have not gotten a response at all, should I assume that this is an unfixable bug and abandon system.net.mail?

thanks