Microsoft Developer Network >
포럼 홈
>
.NET Base Class Library
>
how to use server.mappath(test.bat) in vb.net
how to use server.mappath(test.bat) in vb.net
- Dim path As String
path = "test.bat"
Dim sw As System.IO.StreamWriter
Dim fi As System.IO.FileInfo
fi = New System.IO.FileInfo(Server.MapPath(path))
sw = fi.CreateText()
'The List Of Operations you want to execute.
sw.WriteLine("cd c:\\")
sw.WriteLine("md c:\\dummy")
sw.WriteLine("cd dummy")
sw.WriteLine("C:\\winJavaCoverage\\bin\\javacoverage -F c:\\test.java")
sw.WriteLine("javac Pack\\Test.java")
sw.WriteLine("java Pack\\Test")
sw.Close()
this is the code i hve used behind my form in vb.net.it is not wrking as it is showing error as server in server.mappath is not declared.i dnt know what to do.i hve tried my best.can u pls tell me so that i can run and gets the benefit.
답변
- You can use
Application.StartupPath gives you the path executable of your application.
fi=New System.IO.FileInfo(Application.StartupPath & "\" & path)- 답변으로 표시됨eryangMSFT, 중재자2009년 11월 11일 수요일 오전 8:46
- 답변으로 제안됨Tamer OzMVP2009년 11월 7일 토요일 오후 4:08
- Response.Write writes a string to the response stream with another saying basicly in page in asp.net
In windows forms you can use MessageBox.Show to show messages.- 답변으로 표시됨eryangMSFT, 중재자2009년 11월 11일 수요일 오전 8:46
모든 응답
- Server.Mappath could only be used in asp.net applications.
Is your application Asp.net or Windows Application.
If it is asp.net application try.
System.Web.HttpContext.Current.Server.MapPath(Path)
- no i hve created a form in vb.net and for that i m using this code.tell me something vb.net
- You can use
Application.StartupPath gives you the path executable of your application.
fi=New System.IO.FileInfo(Application.StartupPath & "\" & path)- 답변으로 표시됨eryangMSFT, 중재자2009년 11월 11일 수요일 오전 8:46
- 답변으로 제안됨Tamer OzMVP2009년 11월 7일 토요일 오후 4:08
thank u so much for ur response.this helped me.
can u tell me 1 mre thing.
this.Response.Write(String.Format(fmtOutput, results.Replace(System.Environment.NewLine, "")))
the above statement gives error as response is not declared.i have done few things like i hve used me instead of this or form1.
but nothing works.can u tell me what shd i do?- Response.Write writes a string to the response stream with another saying basicly in page in asp.net
In windows forms you can use MessageBox.Show to show messages.- 답변으로 표시됨eryangMSFT, 중재자2009년 11월 11일 수요일 오전 8:46

