With different credentials.

Discussion in 'ASP .Net' started by Yahya, Apr 4, 2005.

  1. Yahya

    Yahya Guest

    Dear Sirs,

    I would like to run the below code using other credentials than the user
    running it, how can I use different credentials?

    Thank you,
    Yahya

    Dim msgobj

    msgobj = CreateObject("CDO.Message")

    msgobj.DataSource.Open(sUrl, , 3)

    If msgobj.fields("urn:schemas:httpmail:hasattachment").value = True And
    msgobj.fields("DAV:contentclass").value = "urn:content-classes:message" Then

    msgobj.attachments.deleteall()

    msgobj.fields("urn:schemas:mailheader:keywords").value = "Attachment"

    msgobj.fields.update()

    msgobj.DataSource.Save()

    End If

    msgobj = Nothing
     
    Yahya, Apr 4, 2005
    #1
    1. Advertising

  2. Yahya

    Pipo Guest

    Yahya,

    Check if the
    WindowsIdentity.Impersonate Method
    Allows code to impersonate a different Windows user is what you're looking
    for

    "Yahya" <> wrote in message
    news:...
    > Dear Sirs,
    >
    > I would like to run the below code using other credentials than the

    user
    > running it, how can I use different credentials?
    >
    > Thank you,
    > Yahya
    >
    > Dim msgobj
    >
    > msgobj = CreateObject("CDO.Message")
    >
    > msgobj.DataSource.Open(sUrl, , 3)
    >
    > If msgobj.fields("urn:schemas:httpmail:hasattachment").value = True And
    > msgobj.fields("DAV:contentclass").value = "urn:content-classes:message"

    Then
    >
    > msgobj.attachments.deleteall()
    >
    > msgobj.fields("urn:schemas:mailheader:keywords").value = "Attachment"
    >
    > msgobj.fields.update()
    >
    > msgobj.DataSource.Save()
    >
    > End If
    >
    > msgobj = Nothing
    >
    >
    >
    >
     
    Pipo, Apr 4, 2005
    #2
    1. Advertising

  3. You can use impersonation to have ASP.NET run under a different user
    account.

    For example, you can add a line similar to this to your web.config file:
    <identity impersonate="true" userName="domain\MyUserName">
    password="password"/>

    Here's more info on impersonation:
    http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp

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


    "Yahya" <> wrote in message
    news:...
    > Dear Sirs,
    >
    > I would like to run the below code using other credentials than the
    > user
    > running it, how can I use different credentials?
    >
    > Thank you,
    > Yahya
    >
    > Dim msgobj
    >
    > msgobj = CreateObject("CDO.Message")
    >
    > msgobj.DataSource.Open(sUrl, , 3)
    >
    > If msgobj.fields("urn:schemas:httpmail:hasattachment").value = True And
    > msgobj.fields("DAV:contentclass").value = "urn:content-classes:message"
    > Then
    >
    > msgobj.attachments.deleteall()
    >
    > msgobj.fields("urn:schemas:mailheader:keywords").value = "Attachment"
    >
    > msgobj.fields.update()
    >
    > msgobj.DataSource.Save()
    >
    > End If
    >
    > msgobj = Nothing
    >
    >
    >
    >
     
    Steve C. Orr [MVP, MCSD], Apr 4, 2005
    #3
    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. mdh
    Replies:
    0
    Views:
    947
  2. Jørn A.
    Replies:
    3
    Views:
    5,649
    Scott Allen
    Sep 10, 2004
  3. Andy Klare

    File.Move() using different credentials?

    Andy Klare, Nov 30, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    756
    Andy Klare
    Nov 30, 2006
  4. Replies:
    1
    Views:
    114
    Dominick Baier [DevelopMentor]
    Jun 18, 2006
  5. Eigh
    Replies:
    2
    Views:
    807
Loading...

Share This Page