这些语句 我觉得没问题啊 为什么没有记录呢?我在自己的电脑上测试的时候没有任何记录在sqlin.txt中,想写入记入 应该怎么写呢?string clientIp = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();// WbfTools.BLL.Utils.GetIP();
string clientURL = System.Web.HttpContext.Current.Request.Url.ToString();
string serverParch = System.Web.HttpContext.Current.Server.MapPath("~/");
//写日志
System.IO.StreamWriter sw = System.IO.File.AppendText(serverParch + "\\sqlin.txt");//System.Net.WebRequestMethods.File.AppendText(serverParch + "\\sqlin.txt");
sw.WriteLine("IP:" + clientIp + " URL:" + clientURL + " DateTime:" + DateTime.Now.ToString());
sw.Flush();
sw.Close();
sw.Dispose();
string clientURL = System.Web.HttpContext.Current.Request.Url.ToString();
string serverParch = System.Web.HttpContext.Current.Server.MapPath("~/");
//写日志
System.IO.StreamWriter sw = System.IO.File.AppendText(serverParch + "\\sqlin.txt");//System.Net.WebRequestMethods.File.AppendText(serverParch + "\\sqlin.txt");
sw.WriteLine("IP:" + clientIp + " URL:" + clientURL + " DateTime:" + DateTime.Now.ToString());
sw.Flush();
sw.Close();
sw.Dispose();
解决方案 »
- SiteMapPath发布在FF下的问题
- 如何改变GridView中添加的控件的属性
- 给大家一个实体生成工具,效果很不错. 刚才那个帖子图片没出来,sorry
- 如何将数据库中格式(html)文本正常显示 freetextbox
- 异常详细信息:The connection is closed.!小弟初学!
- 如何实现textbox输入内容只能为数字,并控制位数
- 哪个装asp.net的命令怎么来着? 好像是aspnet_reg什么的,高手说一下,谢了
- 继续关注水晶报表输出问题
- 请教一个javascript问题--关于textbox?(我很菜但很固执!)
- 如何在VS。net中,建立web 应用项目时,如何把项目建在别一只机器上?
- 急急急。。。为什么我用上传控件上传的图片在页面显示不出来呢?
- 求一个asp.net上传的插件 支持批量上传显示进度条而且是免费的
现在记录日志有log4net、nlog之类的,也有自己写的直接写文件的方法(一般用多线程)。
- sw {System.IO.StreamWriter} System.IO.StreamWriter
- base {System.IO.StreamWriter} System.IO.TextWriter {System.IO.StreamWriter}
- base {System.IO.StreamWriter} System.MarshalByRefObject {System.IO.StreamWriter}
- 非公共成员
- [System.IO.StreamWriter] {System.IO.StreamWriter} System.IO.StreamWriter
- base {System.IO.StreamWriter} System.IO.TextWriter {System.IO.StreamWriter}
- base {System.IO.StreamWriter} System.MarshalByRefObject {System.IO.StreamWriter}
__identity null object
Identity null object
- CoreNewLine {char[2]} char[]
[0] 13 '\r' char
[1] 10 '\n' char
InternalFormatProvider null System.IFormatProvider
autoFlush false bool
+ byteBuffer {byte[3075]} byte[]
+ charBuffer {char[1024]} char[]
charLen 1024 int
charPos 0 int
Closable true bool
closable true bool
+ encoder {System.Text.UTF8Encoding.UTF8Encoder} System.Text.Encoder {System.Text.UTF8Encoding.UTF8Encoder}
+ encoding {System.Text.UTF8Encoding} System.Text.Encoding {System.Text.UTF8Encoding}
haveWrittenPreamble true bool
+ mdaHelper {System.IO.MdaHelper} System.IO.MdaHelper
+ stream {System.IO.FileStream} System.IO.Stream {System.IO.FileStream}
__identity null object
Identity null object
+ Encoding {System.Text.UTF8Encoding} System.Text.Encoding {System.Text.UTF8Encoding}
+ FormatProvider {zh-CN} System.IFormatProvider {System.Globalization.CultureInfo}
NewLine "\r\n" string
+ 静态成员
+ 非公共成员
AutoFlush false bool
+ BaseStream {System.IO.FileStream} System.IO.Stream {System.IO.FileStream}
+ Encoding {System.Text.UTF8Encoding} System.Text.Encoding {System.Text.UTF8Encoding}
+ 静态成员
+ 非公共成员
正在中止线程
这是怎么回事?
但是页面上还是有显示try中的值