Server MapPath

Discussion in 'ASP .Net' started by Henrique Berenguel, Jun 24, 2003.

  1. Hello folks. How do I solve the problem below?

    when my program executes the line below :

    Package.WriteXml(Server.MapPath(strID[1] + ".XML"));

    Ireceive the following error message:

    System.Web.Services.Protocols.SoapException: Server was unable to process
    request. ---> System.UnauthorizedAccessException: Access to the path
    "c:\inetpub\wwwroot\postingcenter\SGOC4.XML" is denied. at
    System.IO.__Error.WinIOError(Int32 errorCode, String str) at
    System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
    FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean
    bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode,
    FileAccess access, FileShare share) at System.Xml.XmlTextWriter..ctor(String
    filename, Encoding encoding) at System.Data.DataSet.WriteXml(String
    fileName, XmlWriteMode mode) at System.Data.DataSet.WriteXml(String
    fileName) at PostingCenter.pc0001.PostMessageToEMS(DataSet Package, String
    sFromModule, String sToModule) in
    c:\inetpub\wwwroot\postingcenter\pc0001.asmx.cs:line 149 at
    PostingCenter.pc0001.DispatchMessage(DataSet Package, String sFromModule,
    String sToModule) in c:\inetpub\wwwroot\postingcenter\pc0001.asmx.cs:line
    168 at PostingCenter.pc0001.sendPackage(DataSet Package, String sFromModule,
    String[] sToModule) in c:\inetpub\wwwroot\postingcenter\pc0001.asmx.cs:line
    108 --- End of inner exception stack trace ---
    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information
    about the error and where it originated in the code.

    Exception Details: System.Web.Services.Protocols.SoapException:
    System.Web.Services.Protocols.SoapException: Server was unable to process
    request. ---> System.UnauthorizedAccessException: Access to the path
    "c:\inetpub\wwwroot\postingcenter\SGOC4.XML" is denied. at
    System.IO.__Error.WinIOError(Int32 errorCode, String str) at
    System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
    FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean
    bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode,
    FileAccess access, FileShare share) at System.Xml.XmlTextWriter..ctor(String
    filename, Encoding encoding) at System.Data.DataSet.WriteXml(String
    fileName, XmlWriteMode mode) at System.Data.DataSet.WriteXml(String
    fileName) at PostingCenter.pc0001.PostMessageToEMS(DataSet Package, String
    sFromModule, String sToModule) in
    c:\inetpub\wwwroot\postingcenter\pc0001.asmx.cs:line 149 at
    PostingCenter.pc0001.DispatchMessage(DataSet Package, String sFromModule,
    String sToModule) in c:\inetpub\wwwroot\postingcenter\pc0001.asmx.cs:line
    168 at PostingCenter.pc0001.sendPackage(DataSet Package, String sFromModule,
    String[] sToModule) in c:\inetpub\wwwroot\postingcenter\pc0001.asmx.cs:line
    108 --- End of inner exception stack trace ---

    Source Error:

    Line 35:
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.o
    rg/sendPackage", RequestNamespace="http://tempuri.org/",
    ResponseNamespace="http://tempuri.org/",
    Use=System.Web.Services.Description.SoapBindingUse.Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    Line 36: public int sendPackage(System.Data.DataSet Package, string
    sFromModule, string[] sToModule) {
    Line 37: object[] results = this.Invoke("sendPackage", new
    object[] {
    Line 38: Package,
    Line 39: sFromModule,


    Source File: c:\inetpub\wwwroot\sgocnet\Web
    References\localhost1\Reference.cs Line: 37

    Stack Trace:

    [SoapException: System.Web.Services.Protocols.SoapException: Server was
    unable to process request. ---> System.UnauthorizedAccessException: Access
    to the path "c:\inetpub\wwwroot\postingcenter\SGOC4.XML" is denied.
    at System.IO.__Error.WinIOError(Int32 errorCode, String str)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
    access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath,
    Boolean bFromProxy)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
    access, FileShare share)
    at System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding)
    at System.Data.DataSet.WriteXml(String fileName, XmlWriteMode mode)
    at System.Data.DataSet.WriteXml(String fileName)
    at PostingCenter.pc0001.PostMessageToEMS(DataSet Package, String
    sFromModule, String sToModule) in
    c:\inetpub\wwwroot\postingcenter\pc0001.asmx.cs:line 149
    at PostingCenter.pc0001.DispatchMessage(DataSet Package, String
    sFromModule, String sToModule) in
    c:\inetpub\wwwroot\postingcenter\pc0001.asmx.cs:line 168
    at PostingCenter.pc0001.sendPackage(DataSet Package, String sFromModule,
    String[] sToModule) in c:\inetpub\wwwroot\postingcenter\pc0001.asmx.cs:line
    108
    --- End of inner exception stack trace ---]

    System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient
    Message message, WebResponse response, Stream responseStream)
    System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
    methodName, Object[] parameters)
    sgocnet.localhost1.pc0001.sendPackage(DataSet Package, String
    sFromModule, String[] sToModule) in c:\inetpub\wwwroot\sgocnet\Web
    References\localhost1\Reference.cs:37
    sgocnet.comOfficer.PostMessage(DataSet Package, String sFromModule,
    String[] sToModule) in c:\inetpub\wwwroot\sgocnet\comofficer.cs:32
    sgocnet.comOfficer.PreparePackage(DataSet Package, String sFromModule,
    String[] sToModule) in c:\inetpub\wwwroot\sgocnet\comofficer.cs:24
    sgocnet.co0005.SendMessageForOfficer() in
    c:\inetpub\wwwroot\sgocnet\co0005.aspx.cs:294
    sgocnet.co0005.btIncluir_Click(Object sender, EventArgs e) in
    c:\inetpub\wwwroot\sgocnet\co0005.aspx.cs:470
    System.Web.UI.WebControls.Button.OnClick(EventArgs e)

    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
    stBackEvent(String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    sourceControl, String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    System.Web.UI.Page.ProcessRequestMain() +1263
    Henrique Berenguel, Jun 24, 2003
    #1
    1. Advertising

  2. Henrique Berenguel

    buddha-smiles

    Joined:
    Oct 7, 2006
    Messages:
    1
    Location:
    kerala
    it seems that i dont have the permission to access the folder
    buddha-smiles, Dec 18, 2006
    #2
    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. Jon
    Replies:
    5
    Views:
    11,116
    Scott M.
    Jan 17, 2010
  2. Peter Row
    Replies:
    0
    Views:
    454
    Peter Row
    Mar 1, 2004
  3. =?Utf-8?B?dHBhcmtzNjk=?=

    server.mappath vs. request.mappath

    =?Utf-8?B?dHBhcmtzNjk=?=, Mar 10, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,122
    Juan T. Llibre
    Mar 11, 2007
  4. Replies:
    4
    Views:
    944
    Juan T. Llibre
    Oct 7, 2007
  5. AAaron123
    Replies:
    11
    Views:
    1,185
    AAaron123
    Sep 9, 2009
Loading...

Share This Page