HOW TO: ????? ????? ????????? ?????? ???????? .NET ???? ??? ASP.NET ? Visual C#

?????? ????????? ?????? ?????????
???? ???????: 318425 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ???? ????? ????? ????? ???? ??? ? ???? ???? ??? ?????? ????????? ???????? ??????? ???????? Microsoft ASP.NET ? Microsoft Visual C# .NET. ????? ??????? ASP.NET ? Visual C# .NET ?????? ???? ??? ???? ????????? ???????? ??? ???? ??? ???? ??? ? ??????? ????????? ???????? ?? ???? ??? ???? ???. ???? ??????? ??? ?????? "???? ????? ?????????" ??????? ??? ?????.

????? ???? ???

  1. ?? ??????? ??? ?? Microsoft Visual Studio .NET ???? ??? ???? ?? ???? ??? ???????.
  2. ?? Visual C# ?????? ??? ???? ??? ASP.NET. ???? ?? ??? http://localhost/DocumentManagementService ?? ?????? ??? ?? ???? ??? ?????. ?????????? ??? ????? Service1.asmx ?? ??? ????? ?? ????? ??? ???????.
  3. ?? ??????? ???? ???? ??? ????? ???? ????? ??? ????????? ???????? ?? Service1.asmx.
  4. ?? ?????? ????????? ???????? WebMethods ??????? ??? ????? Service1:
    
    [WebMethod]
    public bool SaveDocument( Byte[] docbinaryarray, string docname)
    {
    	string strdocPath;
    	strdocPath = "C:\\DocumentDirectory\\" + docname;
    	FileStream objfilestream =new FileStream(strdocPath,FileMode.Create,FileAccess.ReadWrite);
    	objfilestream.Write(docbinaryarray,0,docbinaryarray.Length);
    	objfilestream.Close();
    
    	return true;
    }
    
    [WebMethod]
    public int GetDocumentLen(string DocumentName)
    {
    	string strdocPath;
    	strdocPath = "C:\\DocumentDirectory\\" + DocumentName;
    
    	FileStream objfilestream = new FileStream(strdocPath,FileMode.Open,FileAccess.Read);
    	int len = (int)objfilestream.Length;			
    	objfilestream.Close();
    
    	return len;
    } 
    
    
    [WebMethod]
    public Byte[] GetDocument(string DocumentName)
    {
    	string strdocPath;
    	strdocPath = "C:\\DocumentDirectory\\" + DocumentName;
    
    	FileStream objfilestream = new FileStream(strdocPath,FileMode.Open,FileAccess.Read);
    	int len = (int)objfilestream.Length;			
    	Byte[] documentcontents  = new Byte[len];
    	objfilestream.Read(documentcontents,0,len);
    	objfilestream.Close();
    
    	return documentcontents;	
    } 
    					

    ??????:????????? ???????? ???? ????????? <root>: ???? ?????? \\DocumentDirectory\\ ??? ??????. ????? ??? ??? ?????? ??? ???? ??? ??? ???? ??? ?????????.

  5. ????? ????? ????? ??????? ??? ????? Service1.asmx:
    using System.IO;
  6. ?????? ???? ???:
    1. ??????? ????? ? ???? ??? "????" ???? ????? ???? ???. ???? ??? ??? ????? ?????? ??? ??? ???? ?????? "???????" ?? ??? ??????.
    2. ???? ?? ???? ?????? SaveDocument ? GetDocumentGetDocumentLen.
    3. ????? ???? ?????? ??? ?????? ?????.

????? ???? ????? ???

  1. ?? ??????? ??? ?? Visual Studio .NET ???? ??? ????? ??????? ?? ???? ??? ????? ????.
  2. ?? Visual C# ?????? ? ??? ????? Windows ?? ???? ??? ?????. ?????????? ??? ????? Form1.
  3. ?? ?????? ???? ??? ??? ???? ???? ??? ???:
    1. ?? "?????? ??????" ???? ??? ?????? ?????? ??? ???? ??????? ??????. ?? ??? ????? ???? ??? ??? ????? ??????.
    2. ?? ???? ?????? ????? ?????? ??? ? ???? ????? URL ??? ??? ??? ??? ????? ??? (WSDL) ????? ??? ?? ?? ???? ENTER.

      ??????: ?? ?????? ????????? ??? WSDL http://localhost/DocumentManagementService/Service1.asmx?WSDL.
    3. ?? ???? ?????? ????? ?????? ??? ? ???? ??? ????? ????.
  4. ?? ?????? ?????? ??? Form1 ". ????? ??????? Text button1 ??? ????? ???? ??? ??????. ????? ??????? Text button2 ??? ??????? ????? ?? ??????.
  5. ???? ????? ??????? ??? button1 ? button2 ?????? ????????? ???? ??????? ??????? ??????.
  6. ??????? ??????? ???? ???????? ???????? ???????:
    string sFile = "<file path>";
    
    private void button1_Click(object sender, System.EventArgs e)
    {
    	FileStream objfilestream = new FileStream(sFile,FileMode.Open,FileAccess.Read);
    	int len = (int)objfilestream.Length;
    	Byte[] mybytearray = new Byte[len];
    	objfilestream.Read(mybytearray,0,len);
    	localhost.Service1 myservice = new localhost.Service1();
    	myservice.SaveDocument(mybytearray,sFile.Remove(0,sFile.LastIndexOf("\\")+1));
    	objfilestream.Close();
    }
    
    private void button2_Click(object sender, System.EventArgs e)
    {
    	MemoryStream objstreaminput = new MemoryStream();
    	FileStream objfilestream = new FileStream(sFile.Insert(sFile.LastIndexOf("."),"2"), FileMode.Create,FileAccess.ReadWrite);
    						
    	localhost.Service1 myservice = new localhost.Service1();
    	int len = (int)myservice.GetDocumentLen(sFile.Remove(0,sFile.LastIndexOf("\\")+1)); 
    	Byte[] mybytearray = new Byte[len];
    	mybytearray = myservice.GetDocument(sFile.Remove(0,sFile.LastIndexOf("\\")+1));
    	objfilestream.Write(mybytearray,0,len);
    	objfilestream.Close();
    }
    					
    ??????: ????? sFile ??? ?? ????? ???? ????? ?????? ??? ????? ???? ???? ????? ??? ??????. ????? ??? ????? ??????? ???? ?? ??? ?????? ?? ??? ????? ???? 2 ??? ??? ?????.

  7. ????? ????? ????? ??????? ?? ????? ?????:
    using System.IO;
  8. ?? "?????? ??????" ???? ??? ?????? ?????? ??? ???? ??????? ??????. ?? ??? ?????? ?? Project ??? ??????? ??? ????? ??????.

???? ?? ??????

  1. ?? ??????? ????? ? ???? ??? ????. ???? "Form1".
  2. ???? ??? ???? ????? ????? ???? ??? ??????. ????? ??? ??????? ??????? ??? SaveDocument. ???? ??? ??????? ??? ???? ??????? ?????? ?? <root>: ?????? \DocumentDirectory\ ??? ??????. ??? ??? "???????" ? ???? ?? ???? ????? ?? ???? ??????.
  3. ???? ??? ???? ?????? ??????? ??????? ?? ??????. ????? ??? ??????? ??????? ??? GetDocument. ??? ??????? ??? ???????? ??????? ?? <root>: ?????? \DocumentDirectory\ ??? ??????. ?? ??? ??????? ??? ???? ??????? ?????? ?? ????????? ????????.

?????

????? ?? ?????????? ???? ?? Microsoft Visual Studio .NET ?????.

???????

???? ???????: 318425 - ????? ??? ??????: 21/????/1424 - ??????: 4.2
????? ???
  • Microsoft ASP.NET 1.0
  • Microsoft Visual C# .NET 2002 Standard Edition
????? ??????: 
kbmt kbhowtomaster KB318425 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????318425

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com