ASP.NET模拟指定帐号权限, 删除非本机图片文件
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ArgumentException: 不支持 URI 格式。
源错误:
行 30: protected void BTNCLick(object sender, EventArgs e)
行 31: {
行 32: System.IO.File.Delete(path + "200911313360.jpg");
行 33: ScriptManager.RegisterStartupScript(Page, typeof(Page), "ok", "alert('删除成功');", true);
行 34: }
不支持 URI 格式。
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lbExist;
protected System.Web.UI.WebControls.Label Label2;
public const int LOGON32_LOGON_INTERACTIVE = 2;
public const int LOGON32_PROVIDER_DEFAULT = 0;
WindowsImpersonationContext impersonationContext;
[DllImport("advapi32.dll", CharSet=CharSet.Auto)]
public static extern int LogonUser(String lpszUserName,String lpszDomain,
String lpszPassword,int dwLogonType,int dwLogonProvider,
ref IntPtr phToken);
[DllImport("advapi32.dll", CharSet=System.Runtime.InteropServices.CharSet.Auto,
SetLastError=true)]
public extern static int DuplicateToken(IntPtr hToken,int impersonationLe
相关文档:
首先检查Web.config文件里是否是如下代码:
打开VS2005创建新项目,选择ASP.NET AJAX项目,然后把该项目Web.config文件的内容全部复制到你报错的Web.config文件里。
如果这个办法未能解决办法请查看该项目根目录的Bin文件夹内是否有System.Web.Extensions.Design.dll、System.Web.Extensions.dll、A ......
1、给删除按钮添加是否确认提示:
前台方法:OnClientClick="return window.confirm('你确定要删除吗?')"
后台方法:btnDelete.Attributes.Add("onclick", "return confirm('您确定要删除吗?');");
2、DataSet中取值:
lblTitle.Text = ds.Tables[0].Rows[0]["Title"]. ......
什么是LINQ?
LINQ是语言集成查询(Language Integrated Query)的简称,是Visual Studio 2008 和.NET Framework 3.5 版中一项,突破性的创新,它在对象领域和数据领域之间架起了一座桥梁.
一个简单LINQ查询:
&n ......
1
private void Focus(string sDomID)
{
RegScript("focus", "document.getElementById(\"" + sDomID + "\").focus();");
  ......