it is a web application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mastanrao
    New Member
    • Jan 2008
    • 10

    it is a web application

    Hi,
    i want access file in another system with in my system.How to connected to 2nd system in dotnet.
    Ex:server name:sudheer drive:d:/documents and settings/aspnet.pdf
    my system:sever:ad ministrator

    i want to access this file in my system.How is it possible.please send the code if possible asap.
    Thank you so much.
  • leoiser
    New Member
    • Jul 2007
    • 41

    #2
    I think you dont ve proper access right..

    Did u add account for annoymus/IIS user in that folder?

    Originally posted by mastanrao
    Hi,
    i want access file in another system with in my system.How to connected to 2nd system in dotnet.
    Ex:server name:sudheer drive:d:/documents and settings/aspnet.pdf
    my system:sever:ad ministrator

    i want to access this file in my system.How is it possible.please send the code if possible asap.
    Thank you so much.

    Comment

    • mzmishra
      Recognized Expert Contributor
      • Aug 2007
      • 390

      #3
      You should be able to access the file using the server name and shared folder, like this \\ServerName\Sh aredFolder\Your File.txt.

      string path = @"\\ServerName\ SharedFolder\My Test.txt";
      try {
      if (File.Exists(pa th)) {
      // File exists, then do something with it
      }
      }

      Comment

      • mastanrao
        New Member
        • Jan 2008
        • 10

        #4
        Originally posted by mzmishra
        You should be able to access the file using the server name and shared folder, like this \\ServerName\Sh aredFolder\Your File.txt.

        string path = @"\\ServerName\ SharedFolder\My Test.txt";
        try {
        if (File.Exists(pa th)) {
        // File exists, then do something with it
        }
        }


        Hi,
        thanks for the information.

        i wrote the code like this.
        Code:
        string path=@"\\administrator\d\raja\aspnet.doc";
        string type = Path.GetExtension(path); 
        if (type == ".pdf")
                    {
                        Response.ContentType = "application/pdf";
                    }
                    else if (type == ".jpg" || type == ".jpeg")
                    {
                        Response.ContentType = "image/jpeg";
                    }
                    else if (type == ".gif")
                    {
                        Response.ContentType = "image/gif";
                    }
                    else if (type == ".doc")
                    {
                        Response.ContentType = "application/msword";
                    }
                    else if (type == ".xls")
                    {
                        Response.ContentType = "application/vnd.ms-excel";
                    }
                    else if (type == ".txt")
                    {
                        Response.ContentType = "text/html";
                        //response.contenttype = "application / vnd.text";
                    }
                    else if (type == ".htm" || type == ".html" || type == ".asp")
                    {
                        Response.ContentType = "text/html";
                    }
                    else if (type == ".mdb")
                    {
                        Response.ContentType = "application/vnd.ms-access";
                    }
                    else if (type == ".bmp")
                    {
                        Response.ContentType = "images/bmp";
                    }
                    else if (type == "")
                    {
                        Response.Write("file type must be match");
                    }
                    Response.WriteFile(path);
                    Response.End();
                    Response.Close();

        here it is showing error like this:The network path was not found.

        please give me the solution for this asap.
        Thaks you so much.

        Comment

        • mastanrao
          New Member
          • Jan 2008
          • 10

          #5
          Originally posted by mzmishra
          You should be able to access the file using the server name and shared folder, like this \\ServerName\Sh aredFolder\Your File.txt.

          string path = @"\\ServerName\ SharedFolder\My Test.txt";
          try {
          if (File.Exists(pa th)) {
          // File exists, then do something with it
          }
          }


          hi,
          Here it is showing error like this:Logon failure: unknown user name or bad password.


          where can i provide the password.
          please give me the reply asap.

          Comment

          • mastanrao
            New Member
            • Jan 2008
            • 10

            #6
            please send me solution asap.
            Thanking you

            Comment

            • kenobewan
              Recognized Expert Specialist
              • Dec 2006
              • 4871

              #7
              I believe that we are back to folder permissions again. Did you give aspnet access rights to the folder?

              Comment

              • mastanrao
                New Member
                • Jan 2008
                • 10

                #8
                Originally posted by kenobewan
                I believe that we are back to folder permissions again. Did you give aspnet access rights to the folder?

                No.I don't know how to give the permissions to the folder.Please give me the idea how to give the permissions to folder.I'm expecting reply soon from you.
                Thanks for giving the solution.

                Comment

                • kenobewan
                  Recognized Expert Specialist
                  • Dec 2006
                  • 4871

                  #9
                  Exact method depends on OS, but right click on the folder > properties > sharing > add ASPNET account > confirm.

                  Comment

                  • mastanrao
                    New Member
                    • Jan 2008
                    • 10

                    #10
                    Originally posted by kenobewan
                    Exact method depends on OS, but right click on the folder > properties > sharing > add ASPNET account > confirm.
                    hi,
                    it is not working.It is showing path is in correct manner.please let me know the solution asap.

                    Comment

                    Working...