protected void Button1_Click(object sender, EventArgs e) { if (this.FileUpload1.HasFile) { using (Stream stream = this.FileUpload1.PostedFile.InputStream) { var doc = new Aspose.Words.Document(stream, this.FileUpload1.PostedFile.FileName); var filePath = Page.MapPath("temp"); if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } var fileName = Path.Combine(filePath, Guid.NewGuid().ToString() + ".pdf"); doc.SaveToPdf(fileName); } } }