Showing posts with label supposed. Show all posts
Showing posts with label supposed. Show all posts

Wednesday, March 28, 2012

System.IO.Path.GetTempFileName

Hi,
System.IO.Path.GetTempFileName( ) is supposed to create a temporary file and give us the path to the created file.
By default, where does this temp file get created? C:\Temp, C:\WinNT ?
Bcos right now this fails and error we get is "Access denied". But we dont know which folder's permissions to change as we dont know where this temp file is supposed to get created.

It will be in the ASPNET user's Temp Directory. For example, on mine:
C:\Documents and Settings\ComputerName\ASPNET\Local Settings\Temp


You are right ! I just found that out by using

tempPathString = Path.GetTempPath()
Thanks !


correctomundo!!
I know this is an old post, but System.IO.Path.GetTempPath() only puts stuff in the ASPNET user directory when the app runs on XP Pro. That is fine for development, but when the app is deployed to a Windows 2003 server the method returns C:\Windows\Temp. Calling GetTempFileName() creates a temp file there. Surely, it isn't safe or a best practice to write to the Windows directory, is it?

Monday, March 26, 2012

System.Net.Mail

This is some code for VB that is supposed to work in ASP. How come it
doesn't seem to work in ASP?
It is supposed to send mail to an SMTP server that requires a username and
password.

'create the mail message
'Dim mail As New MailMessage()

'set the addresses
'mail.From = New MailAddress("me@dotnet.itags.org.mycompany.com")
'mail.To.Add(test1@dotnet.itags.org.testdomain.com)

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

'send the message
'Dim smtp As New SmtpClient("127.0.0.1")

'to authenticate we set the username and password properites on the
SmtpClient
'smtp.Credentials = New NetworkCredential("username", "secret")
'smtp.Send(mail)If you work thru my sample project ... at the blog, you'll find the
different switches you need to experiment with to get an "authentication"
email to work.

I have 1.1 and 2.0 syntaxes.

http://sholliday.spaces.live.com/ 2/8/2006

While the code is in C#, you'll at least see the properties you need to set.

You need to find the
TestApp_2_0 . Program.cs file.

Here is what to find ... under the 2/8/2006 entry
You can download the code HERE. (Right-Click and "Save As" works best)

"AbraAbraCadabra" <nws@.gsw-inc.comwrote in message
news:%23W2kW$6yGHA.1292@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

This is some code for VB that is supposed to work in ASP. How come it
doesn't seem to work in ASP?
It is supposed to send mail to an SMTP server that requires a username and
password.
>
>
'create the mail message
'Dim mail As New MailMessage()
>
'set the addresses
'mail.From = New MailAddress("me@.mycompany.com")
'mail.To.Add(test1@.testdomain.com)
>
'set the content
'mail.Subject = "TEST TEST TEST This is an email"
'mail.Body = "this is the body content of the email."
>
'send the message
'Dim smtp As New SmtpClient("127.0.0.1")
>
'to authenticate we set the username and password properites on the
SmtpClient
'smtp.Credentials = New NetworkCredential("username", "secret")
'smtp.Send(mail)
>
>


I tried your link on two different computers and they both crash about 10
seconds after viewing the first page. Is there a problem with your link?

"sloan" <sloan@.ipass.netwrote in message
news:eQwZRS7yGHA.4496@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>
If you work thru my sample project ... at the blog, you'll find the
different switches you need to experiment with to get an "authentication"
email to work.
>
I have 1.1 and 2.0 syntaxes.
>
http://sholliday.spaces.live.com/ 2/8/2006
>
While the code is in C#, you'll at least see the properties you need to
set.
>
You need to find the
TestApp_2_0 . Program.cs file.
>
>
Here is what to find ... under the 2/8/2006 entry
You can download the code HERE. (Right-Click and "Save As" works best)
>
>
>
"AbraAbraCadabra" <nws@.gsw-inc.comwrote in message
news:%23W2kW$6yGHA.1292@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>This is some code for VB that is supposed to work in ASP. How come it
>doesn't seem to work in ASP?
>It is supposed to send mail to an SMTP server that requires a username
>and
>password.
>>
>>
>'create the mail message
>'Dim mail As New MailMessage()
>>
>'set the addresses
>'mail.From = New MailAddress("me@.mycompany.com")
>'mail.To.Add(test1@.testdomain.com)
>>
>'set the content
>'mail.Subject = "TEST TEST TEST This is an email"
>'mail.Body = "this is the body content of the email."
>>
>'send the message
>'Dim smtp As New SmtpClient("127.0.0.1")
>>
>'to authenticate we set the username and password properites on the
>SmtpClient
>'smtp.Credentials = New NetworkCredential("username", "secret")
>'smtp.Send(mail)
>>
>>


>
>


Use a browser besides IE.

I think microsoft sent an update out for IE.. and it crashes when it goes to
a spaces.msn.com/somebody type site.

They redid the look/feel of the msn spaces.

I get the same issue sometimes.

I thought it was just me, but apparently not.

"AbraAbraCadabra" <nws@.gsw-inc.comwrote in message
news:evdOsLFzGHA.4044@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

I tried your link on two different computers and they both crash about 10
seconds after viewing the first page. Is there a problem with your link?
>
>
>
>
"sloan" <sloan@.ipass.netwrote in message
news:eQwZRS7yGHA.4496@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by


If you work thru my sample project ... at the blog, you'll find the
different switches you need to experiment with to get an


"authentication"

Quote:

Originally Posted by

Quote:

Originally Posted by

email to work.

I have 1.1 and 2.0 syntaxes.

http://sholliday.spaces.live.com/ 2/8/2006

While the code is in C#, you'll at least see the properties you need to
set.

You need to find the
TestApp_2_0 . Program.cs file.

Here is what to find ... under the 2/8/2006 entry
You can download the code HERE. (Right-Click and "Save As" works best)

"AbraAbraCadabra" <nws@.gsw-inc.comwrote in message
news:%23W2kW$6yGHA.1292@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

This is some code for VB that is supposed to work in ASP. How come it
doesn't seem to work in ASP?
It is supposed to send mail to an SMTP server that requires a username
and
password.
>
>
'create the mail message
'Dim mail As New MailMessage()
>
'set the addresses
'mail.From = New MailAddress("me@.mycompany.com")
'mail.To.Add(test1@.testdomain.com)
>
'set the content
'mail.Subject = "TEST TEST TEST This is an email"
'mail.Body = "this is the body content of the email."
>
'send the message
'Dim smtp As New SmtpClient("127.0.0.1")
>
'to authenticate we set the username and password properites on the
SmtpClient
'smtp.Credentials = New NetworkCredential("username", "secret")
'smtp.Send(mail)
>
>



>
>