Asp.Net操作txt,读写取。并对txt文件进行条件查询
1)创建txt文件【web.config】
--------------------------------------------------------------------
<appSettings>
<add key="EditChars" value="D:\Site\ZJPS\TextFile\EditChars.txt"/>
</appSettings>
2) 页面的CS文件中:
--------------------------------------------------------------------
【1】 获取txt文件位置: protected string FileName = System.Configuration.ConfigurationManager.AppSettings["EditChars"].ToString();
【2】 文件操作:创建、写、读 文件。
#region 文件操作
/// <summary>
/// 创建txt文件
/// </summary>
public void CreateToFile()
{
StreamWriter SW;
SW = File.CreateText(FileName);
SW.Close();
}
/// <summary>
/// 写文件
/// </summary>
public void WriteToFile()
{
string InsertStr = "";
if (!File.Exists(FileName))
{
CreateToFile();
InsertStr = "Content#Da
相关文档:
首先检查Web.config文件里是否是如下代码:
打开VS2005创建新项目,选择ASP.NET AJAX项目,然后把该项目Web.config文件的内容全部复制到你报错的Web.config文件里。
如果这个办法未能解决办法请查看该项目根目录的Bin文件夹内是否有System.Web.Extensions.Design.dll、System.Web.Extensions.dll、A ......
在IIS6上部署过ASP.Net MVC的一定知道,为了能让IIS将对ASP.Net MVC的请求转发给ASP.Net处理,必须添加应用程序ISAPI映射。 避免这种映射添加的一种方法是利用已有的映射,例如.aspx扩展名的映射。不过那样的话ASP.Net MVC的Url会很“难看”,“http://localhost/ASPNETMVCAPP/Account.aspx/Logon/”。如果能把其中的.a ......
步骤:
1. 新建一个WEB解决方案名称为HtmlStatic。
2. 在项目下建一个HtmlTemp.htm其代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head&g ......
<asp:FileUpload /> 文件上传控件
实现一个简单的图片文件上传
//上传文件控件使用:实现上传图片功能,上传图片只能是jpg,gif,bmp三种类型,图片大小不超过60kb
后台代码:
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using ......
1. 打开新的窗口并传送参数:
传送参数:
response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')</script>")
接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.为按钮添加对话框
Button1.Attribute ......