WP TutorialLesson 9Free preview
WebPages Files
This lesson is part of ASP · All levels
Summary
Web Pages provide File class for file operations such as reading, writing, deleting, and uploading files from the server side. Functions such as File.ReadAllText, File.WriteAllText, and File.Upload facilitate file manipulation without additional libraries. The file operation must always be limited to type and size validation so that the server is not misused by the user.
Key points
- File.ReadAllText and File.WriteAllText are used to read and write text.
- Check the file's existence before a particular operation.
- Uploads are handled via Request.Files and then saved using the SaveAs method.
- Validation of the extension and file size is mandatory before saving the upload.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.