易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET页面传值_第八篇_WebConfig

+++ 修改WebConfig文件:
<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="connStr" value="Data Source=ora11g;uid=scott;pwd=tiger;unicode=true"/>
  </appSettings>
  <connectionStrings>
    <add name="connStr" connectionString="Data Source=ora11g;uid=scott;pwd=tiger;unicode=true"
       providerName="System.Data.OracleClient"/>
  </connectionStrings>
 <system.web>
  <compilation debug="true">
   <assemblies>
    <add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral,
      PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
  <authentication mode="Windows"/>
 </system.web>
</configuration>
+++ 页面代码如下:
(略)
+++ 后台代码如下:
protected void Page_Load(object sender, EventArgs e)
{
  string connStr = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString.ToString();
  string appStr = ConfigurationManager.AppSettings["connStr"].ToString();
  Response.Write("连接字符串 from CONNECTIONSTRING:" + connStr +
        "</br>连接字符串 from APPSETTINGS:" + appStr);
}
+++ 说明
(1) 这种方式主要保存数据库的连接字符串,因为Web.config文件是可以加密的。


相关文档:

在ASP.NET中使用FCKeditor的方法

之前用的在线编辑器是DotNetTextBox ,并且曾一度觉得它异常强大,如可以给上传的图片加文字水印或者图片水印,但后来发现其上传的图片不容易管理,都挤在一个文件夹里面(免费版,付费版好像可以分文件夹上传保存图片),并且段首空格总不是所见即所得,我编辑时空了两个字符的位置,到了前台页面的时候只有一个字符,所以 ......

ASP.NET的默认调用后台函数

以下是系统自动生成的回调函数
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['Form1'];
if (!theForm) {
    theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.ons ......

asp.net页面事件执行顺序及各事件作用

    protected void Page_Load(object sender, EventArgs e)
    {
    }
    #region OnPreInit 第一步
    protected override void OnPreInit(EventArgs e)
    {
        //检查 ......

ASP.NET页面传值_第二篇_查询字符串

例一:
+++ 第一个页面
++ 页面代码如下:
<div>
 <a href="QueryString04.aspx?blog=DoooooNetooooot.blog.tianya.cn&qq=516535763">超链接传值示例</a>
</div>
++ 后台代码如下:
(略)
+++ 第二个页面
++ 页面代码如下:
(略)
++ 后台代码如下:
protected void Page_Load( ......

ASP.NET页面传值_第四篇_Session

例一:
+++ 修改Global.asax文件:
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{  }
void Application_End(object sender, EventArgs e)
{  }
void Application_Error(object sender, EventArgs e)
{  }
void ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号