Temporatry File Name

Discussion in 'ASP .Net Web Services' started by Thom Little, Mar 9, 2005.

  1. Thom Little

    Thom Little Guest

    I have just finished an ASP.NET application that needs one (the last)
    remaining tweak. It writes two temporary files and then appends them to an
    SMTP message.

    ASP 3 had a function ...
    GetTempName
    .... to generate unique temporary filenames. Is there an easy standard way
    to generate temporary file names in ASP.NET?

    --
    -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd.
    --
    Thom Little, Mar 9, 2005
    #1
    1. Advertising

  2. Thom Little

    [MSFT] Guest

    Hello Thom,

    There is no such a function in ASP.NET or .NET framework. I think we have
    two options here:

    1. Use COM interop and stick on GetTempName.
    2. Use Random Class in .NET to generate random value and compose random
    string.

    Hope this help,

    Luke
    [MSFT], Mar 9, 2005
    #2
    1. Advertising

  3. Thom Little

    Lionel LASKE Guest

    See System.IO.Path.GetTempFileName function
    (http://msdn.microsoft.com/library/d...rlrfsystemiopathclassgettempfilenametopic.asp).
    See an example on
    http://www.dotnetjunkies.com/Tutorial/C53A9DAC-7DBC-4844-9472-74119526093D.dcik

    Lionel.

    "Thom Little" <> a écrit dans le message de news:
    ...
    >I have just finished an ASP.NET application that needs one (the last)
    >remaining tweak. It writes two temporary files and then appends them to an
    >SMTP message.
    >
    > ASP 3 had a function ...
    > GetTempName
    > ... to generate unique temporary filenames. Is there an easy standard way
    > to generate temporary file names in ASP.NET?
    >
    > --
    > -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd.
    > --
    >
    >
    >
    Lionel LASKE, Mar 9, 2005
    #3
  4. Thom Little

    Thom Little Guest

    The answer for me was ...

    string strNameXLS = Path.ChangeExtension ( Path.GetTempFileName( ),
    "xls" );
    StreamWriter swXLS = File.CreateText( strNameXLS );

    Thank you both for helping me with the "final tweak".

    --
    -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd.
    --

    "Lionel LASKE" <> wrote in message
    news:...
    >
    > See System.IO.Path.GetTempFileName function
    > (http://msdn.microsoft.com/library/d...rlrfsystemiopathclassgettempfilenametopic.asp).
    > See an example on
    > http://www.dotnetjunkies.com/Tutorial/C53A9DAC-7DBC-4844-9472-74119526093D.dcik
    >
    > Lionel.
    Thom Little, Mar 9, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?iso-8859-1?B?bW9vcJk=?=
    Replies:
    7
    Views:
    819
    Roedy Green
    Jan 2, 2006
  2. ding feng
    Replies:
    2
    Views:
    2,806
    ding feng
    Jun 25, 2003
  3. Bobby Chamness
    Replies:
    2
    Views:
    2,390
    Joe Smith
    Apr 22, 2007
  4. Jack-2
    Replies:
    3
    Views:
    264
    Jack-2
    Dec 24, 2003
  5. Java  script  Dude

    IE name="name" & form.name property bug

    Java script Dude, Jun 29, 2004, in forum: Javascript
    Replies:
    5
    Views:
    241
    Java script Dude
    Jun 30, 2004
Loading...

Share This Page