locked
Web Service to create Text file RRS feed

  • Question

  • I wrote a web service to create a text file with some contet. the code is working fine in
    Dev system but i copied the code over to the production system and i got the Error below
    i for got to say that in my production system i have no V S2008 installed . IIS is just installed

    this is my code

     

    string usr = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString().Split(new char[] { '\\' })[1];

     

     

    StreamWriter fs = File.CreateText("\\\\" + "arcman051" + "\\" + "In" + ship_ref + usr.ToString() + DateTime.Now.Second.ToString() + ".txt");  // This is line 95

     

     



    Server Error in '/' Application.

     


     

    Logon failure: unknown user name or bad password.

    Description:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [IOException: Logon failure: unknown user name or bad password.
    ]
       System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +10546789
       System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +2580
       System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +138
       System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) +98
       System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize) +139
       System.IO.StreamWriter..ctor(String path, Boolean append) +48
       System.IO.File.CreateText(String path) +47
       Create_Opportunity.shipping.DHL() in C:\MS_CRM\Visual Studio 2008\Create_Opportunity\Create_Opportunity\shipping.aspx.cs:95
       Create_Opportunity.shipping.Button1_Click(Object sender, EventArgs e) in C:\MS_CRM\Visual Studio 2008\Create_Opportunity\Create_Opportunity\shipping.aspx.cs:55
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981



    hussain
    Wednesday, November 25, 2009 9:04 PM

Answers

All replies

  • What user context is your application running under? You need to make sure that the user account you're using has access to the folder that you're trying to access and write to.

    Shafraz

    http://crmdude.wordpress.com/
    Thursday, November 26, 2009 2:42 AM
  • i'm using a domian admin account and i gave him full access rights to that folder
    hussain
    Thursday, November 26, 2009 6:14 AM