sql注入记录写入自己定义的txt文件 求 操作语句!!!

w250840443 2010-10-28 06:01:18
这些语句 我觉得没问题啊 为什么没有记录呢?我在自己的电脑上测试的时候没有任何记录在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();
...全文
330 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
w250840443 2010-10-29
  • 打赏
  • 举报
回复
有个异常 信息:
正在中止线程
这是怎么回事?
但是页面上还是有显示try中的值
w250840443 2010-10-29
  • 打赏
  • 举报
回复
调试信息:
- 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}
+ 静态成员
+ 非公共成员
w250840443 2010-10-29
  • 打赏
  • 举报
回复
这个不行![Quote=引用 6 楼 wubudang 的回复:]

用Server.MapPath(".")代替一下试试
[/Quote]
firefly_2008 2010-10-29
  • 打赏
  • 举报
回复
帮顶。。。。。。。。。。。。。。。
萤火架构 2010-10-29
  • 打赏
  • 举报
回复
调试下

不过在正式环境这样写肯定是不行,要考虑并发。
现在记录日志有log4net、nlog之类的,也有自己写的直接写文件的方法(一般用多线程)。
wubudang 2010-10-29
  • 打赏
  • 举报
回复
用Server.MapPath(".")代替一下试试
w250840443 2010-10-29
  • 打赏
  • 举报
回复
斜杠没有错误吧????
w250840443 2010-10-29
  • 打赏
  • 举报
回复
路径没问题 txt已经存在啊,我现在在想 不会自己攻击自己没有记录吧???[Quote=引用 2 楼 wubudang 的回复:]

调试一下。txt文件不存在的时候先创建一个文件。
[/Quote]
wyman25 2010-10-29
  • 打赏
  • 举报
回复
路径没有问题吧?
wubudang 2010-10-29
  • 打赏
  • 举报
回复
调试一下。txt文件不存在的时候先创建一个文件。
w250840443 2010-10-29
  • 打赏
  • 举报
回复
来个人回答一下啊 !!!!!都不能结贴了 好可怜的 。。。。。。。。。。。。。。。。。

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧