Showing posts with label client. Show all posts
Showing posts with label client. Show all posts

Wednesday, March 28, 2012

System.io.File

When using the File object how do you now whether the path you are putting, is the path of a file on the server or the path of a file on the client machine.

I want to transfer a file from the client machine to the server, does anyone know if the File object is suited for this?I guess the real question there is where did you get the path from.

If the path came from the Posted File - then it is most likely the file path / name from the client not and is not valid for saving on the server
What do you mean when you say where the path came from, what if i hard code a file path to be e.g c:/intepub/newfolder/file.txt

If i put that path into a file object, would that look at c: on the server or client?
It's always a Path on your server or another machine in your network, over which you (or rather the ASPNET worker process or some other user you let the worker process impersonate) have rights to access.

The only time you handle a client path, is when someone has uploaded a file to your server.
Ok, but thats what i want to do using asp.net, i want to allow users to upload a file from their machine to the server. I have done this successfully using Java, but wanted to know if its possible using .net
It's extremely easy using .Net. One line of code will suffice in this very simple scenario:


<%@. Page Language="VB" %>
<%@. import Namespace="System.IO" %>
<script runat="server">
Sub Button_Click( obj As Object, evnt As EventArgs )
inpFileName.PostedFile.SaveAs( Server.MapPath("") & Path.GetFileName(inpFileName.PostedFile.FileName) )
End Sub
</script>
<html>
<head>
<title>Upload file</title>
</head>
<body>
<form enctype="multipart/form-data" runat="Server">
<input id="inpFileName" type="file" runat="Server" /><br>
<asp:Button id="btnFileUp" onclick="Button_Click" Runat="Server" Text="Upload file" /></form>
</body>
</html>

This will save an uploaded file to the root of your web application. Remember to grant rights to write to the physical folder for the ASPNET account. By default the max file size to be uploaded using .Net is set to 4 mb (4096 kb). If you need to up this size, you set it in your application's Web.config file using:

<httpRuntime maxRequestLength="<size in kb you wish to allow>" />

Thanks very much

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 & sending emails with line breaks

Hi,

When a client sends an email via a web form (text entered in a asp:TextBox server control), the email received has no line breaks, and it is displayed in one line. This has bad impact on email readability... How can one overcome this probelm?

Thank you,

Alon

If you are sending mail text in simple text format then you have to use System.Environment.NewLine to move rest text in next line.

SmtpMail.SmtpServer = "1.0.0.127";
MailMessage mm = new MailMessage();
mm.From = "bill@.microsoft.com";
mm.To = "job@.apple.com";
mm.Subject = "";
mm.Body = "line 1" + System.Environment.NewLine + "line 2";


Hi,

Thank you for your reply.

I forgot to metion that the mail is sent in HTML format:

mailMessage.IsBodyHtml =true;

Am I supposed to parse the user's message (the text in the TextBox control), chck for CRLF (or is it \n) and replace it with System.Environment.NewLine? Isn't there some standard way to send the email, as i is in the text box (multiline text box. It looks like a text area)?

Thank you,

Alon


Here is the modified code for HTML formated body

mm.Body = "line 1" + "<br>" + "line 2";

Rest of the code will remain same.


But how can I know where line1 ends and line2 starts? All I have is a string I get form TextBox.Text. From this string I cannot deduce where did the user hit return - it's a "flat" string.

A word about he context of this: this web form is a "Contact Us" page. The TextBox is a multiline text box, which serves as a free text input field.

Thank you,

Alon


As what Firoz said, you have to use the "<br />"

You will use the following code to replace each line in your textbox to break

Replace(textbox1.text, vbCrLf,"<br />")

HTH
Regards


Oooops, now I understand. It works. I thank the both of you.

Alon

System.Net.Mail.SmtpClient

Hi all,

We are using the Asp.Net SMTP Client to send email via our Exchange 2003 SP2
Server. When trying to send email to a local recipient I am getting the
following error:-

Server: 172.19.2.21. Message: Mailbox unavailable. The server response was:
5.7.1 Requested action not taken: message refused

What is causing this? The asp.net machine is on the same LAN as the Exchange
Server. I checked the Exchange Server and all local IPs are in the "allow"
list.

TIA!How do you have the Recipient MailAddress setup? Are you using
name@.domain.local or name@.domain.com
Sounds like an issue with formatting the address correctly, and now
with SmtpClient

param@.community.nospam wrote:

Quote:

Originally Posted by

Hi all,
>
We are using the Asp.Net SMTP Client to send email via our Exchange 2003 SP2
Server. When trying to send email to a local recipient I am getting the
following error:-
>
Server: 172.19.2.21. Message: Mailbox unavailable. The server response was:
5.7.1 Requested action not taken: message refused
>
>
What is causing this? The asp.net machine is on the same LAN as the Exchange
Server. I checked the Exchange Server and all local IPs are in the "allow"
list.
>
TIA!


For the recipient mailaddress I am using name@.domain.com
If I change the SMTPServer on the SMTPClient to another smtp server,
everything works fine.

What could be causing this?

"Sean Chambers" <dkode8@.gmail.comwrote in message
news:1158344339.960590.194450@.h48g2000cwc.googlegr oups.com...

Quote:

Originally Posted by

How do you have the Recipient MailAddress setup? Are you using
name@.domain.local or name@.domain.com
>
Sounds like an issue with formatting the address correctly, and now
with SmtpClient
>
param@.community.nospam wrote:

Quote:

Originally Posted by

>Hi all,
>>
>We are using the Asp.Net SMTP Client to send email via our Exchange 2003
>SP2
>Server. When trying to send email to a local recipient I am getting the
>following error:-
>>
>Server: 172.19.2.21. Message: Mailbox unavailable. The server response
>was:
>5.7.1 Requested action not taken: message refused
>>
>>
>What is causing this? The asp.net machine is on the same LAN as the
>Exchange
>Server. I checked the Exchange Server and all local IPs are in the
>"allow"
>list.
>>
>TIA!


>


I have complete 1.1 and 2.0 examples here:
http://sholliday.spaces.live.com/
2/8/2006 entry.

You need to try the different authentication modes.

Also. check C:\Inetpub\mailroot and see if they're jammed up there.

<param@.community.nospamwrote in message
news:%23gNx4lQ2GHA.1548@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

For the recipient mailaddress I am using name@.domain.com
>
If I change the SMTPServer on the SMTPClient to another smtp server,
everything works fine.
>
What could be causing this?
>
"Sean Chambers" <dkode8@.gmail.comwrote in message
news:1158344339.960590.194450@.h48g2000cwc.googlegr oups.com...

Quote:

Originally Posted by

How do you have the Recipient MailAddress setup? Are you using
name@.domain.local or name@.domain.com
Sounds like an issue with formatting the address correctly, and now
with SmtpClient

param@.community.nospam wrote:

Quote:

Originally Posted by

Hi all,
>
We are using the Asp.Net SMTP Client to send email via our Exchange


2003

Quote:

Originally Posted by

Quote:

Originally Posted by

Quote:

Originally Posted by

SP2
Server. When trying to send email to a local recipient I am getting the
following error:-
>
Server: 172.19.2.21. Message: Mailbox unavailable. The server response
was:
5.7.1 Requested action not taken: message refused
>
>
What is causing this? The asp.net machine is on the same LAN as the
Exchange
Server. I checked the Exchange Server and all local IPs are in the
"allow"
list.
>
TIA!



>
>


Hello Param,

As for the send mail code, are you using the "Network" as the SmtpClient's
"SmtpDeliveryMethod" and have you tried supply a credential or use the
default credential. Also, when using Exchange server in a domain
environment, you should make sure you have permission to send mail as the
"From" address since exchange server will validate this at server-side.

In addition, as you mentioned it works when using another SMTP server, is
that SMTP server a normal SMTP relay server which also transfer message to
another exchange server? If possible you can also create a local
smtpserver through IIS which act as a relay server to the Exchange server
and send mail through this local SMTP server to see whether it works.

So far based on my experience, it is likely a server environment specific
issue. Here is a simple code snippet which works for sending mail to local
domain user through local network exchange server:

==========================
private void btnSend_Click(object sender, EventArgs e)
{
MailMessage msg = new
MailMessage("steven@.microsoft.com","steven@.microsoft.com");
msg.Subject = "Smtp Client Test Message";
msg.IsBodyHtml = true;
msg.Body = "<font size='30'>Hello World</font>";

SmtpClient sc = new SmtpClient("smtphost");

sc.DeliveryMethod = SmtpDeliveryMethod.Network;

sc.UseDefaultCredentials = true;

sc.Send(msg);

}
===========================

Please feel free to post here if you have any other finding or any other
questions on this.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...rt/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Saturday, March 24, 2012

System.Net.WebException: The request was aborted: The request was canceled.

Hello everyone,

Can anyone help me solve this problem? I'm trying to upload files from a client side to the server side, it uploads fine for any small files under <20mb and fails any files >20mb. I have set in the server side web config for the Runtime executionTimeout="650" and the maximum size length is 100MB, it it still fails under 2 minutes from the time it starts upload to the time the request was aborted, the request was cancel. Can anyone tell me is this a timeout from the Client side or a Service side and how do I fix this timeout issue to get the upload files to the host without being timeout?

anyone?


Is the stack trace available?

I suspecting the web.config file doesn't even take effect.


minutem for replying, here is the trace log that fail to upload th large file, because the System.Net.WebException: The request was aborted: The request was canceled.

"12-04-2007 14:52:48: Uploading c:\test\AC.zip to server"
"12-04-2007 14:52:48: http://www.rsvr.com/uploadservice2.0/uploadservice.asmx/Login?uname=randd&pword=test"
"12-04-2007 14:52:53: Valid User."
"12-04-2007 14:52:53: Starting Upload:http://www.rsvr.com/uploadservice2.0/uploadservice.asmx/UploadFile?c:\test\AC.zip "
"12-04-2007 14:54:33: Upload Failed: The request was aborted: The request was canceled."
"12-04-2007 14:54:33: Upload Failed: System.Net.WebException: The request was aborted: The request was canceled.
at System.Net.WebClient.UploadFile(Uri address, String method, String fileName)
at System.Net.WebClient.UploadFile(String address, String method, String fileName)