当我试图通过从下拉列表中选择一个文件将.htm
文件上传到服务器时,我会遇到此异常。下面给出了异常的详细信息
System.IO.IOException was unhandled by user code
Message=The device is not ready.
Source=mscorlib
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Encoding encoding)
at System.IO.File.InternalReadAllText(String path, Encoding encoding)
at System.IO.File.ReadAllText(String path)
at e_request.Report.DropDownList1_SelectedIndexChanged(Object sender, EventArgs e) in C:UsersAdministratorDesktopSmartUltrasoundPatientSchedulingSystemtrunkcodee_requeste_requestReport_Writing.aspx.cs:line 107
at System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e)
at System.Web.UI.WebControls.DropDownList.RaisePostDataChangedEvent()
at System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent()
at System.Web.UI.Page.RaiseChangedEvents()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
string Doc_content = File.ReadAllText("E:\rajesh\US_schedular\template_htm\" + DropDownList1.SelectedItem + ".htm");
Doc_content = Server.HtmlEncode(Doc_content);
foreach (string parameter in details)
{
Doc_content = ReplaceText(Doc_content, variablenames[count], parameter);
count++;
}
CKEditor1.Text = Doc_content;
我认为您不会使用此方法来访问目录。
Server.MapPath(...)
检查此链接1…
检查此链接2…