分类:Web编程
共 944 篇
在需授权才能访问的页面中一般都有相关的程序做身份验证,在ASP中通常是将身份验证的程序单独放在一个文件中,然后在需授权的页面顶部调用这个文件进行验证身份,身份验证失败后就跳转到一指定的页面中(如登录页)。 今天在一ASP.NET站上也有类似的流程,但却总出错,研究了下,下边是简化了的代码: checkuser.aspx: Manage.aspx: 奇怪的是不仅没有跳转到login.aspx页,反而是页面发生了错误"未将对象引用设置到对象的实例"!原因是Session("username")为空值,使用ToString()导致出错!不是放在最前边了,怎么没像ASP那样发生作用呢?其实原因也很简单:ASP.NET和ASP有个很大不同的地方,就是有了Page_Load等事件,Page_Load在页面一打开就触发了,它里面的代码比页面中其他代码都先执行!所以在上边的例子中应是先执行了Page_Load,再执行checkuser(),这就不难解释为什么没有跳转反而出错了。知道了原因稍加修改即可:…
👤 博主
📅 2008-04-09
👁 4321
👍 0
📂 Web编程
阅读全文 →
一直觉得ASP的include非常的别扭,一是它不能放在""之间,感觉很独特,很格格不入,二是它不能像PHP的include那样可以动态的随意包含文件!以前也有人试图解决过这个问题,但总是不尽完美,今天在pscode.com又看到有人写了个类来解决这个问题,可以说它是在我所见过的解决方法中最好的了。由于原类中存在一些不足,我稍做了修改,下边为修改后的代码: 修改说明: 1.原类convert2code函数中使用"|"做为分隔符,一旦包含文件中存在Response.Write("mzwu|com")类似的语句将导致出错,用"|"做为分隔符更是大大提高了出错的机率!修改后增加了一个变量str_separator,可自由定义分隔符,降低出错率。…
👤 博主
📅 2008-04-09
👁 6304
👍 0
📂 Web编程
阅读全文 →
运行后页面源代码如下: 可见"return CheckForm1(document.form1);"后背后的脚本根本就不再执行了,所以PostBackUrl也就失去了作用,解决方法是不使用PostBackUrl,在脚本CheckForm1动态改变表单的action属性的。 经测试发现把Button改为LinkButton也可以: 运行后页面源代码如下: 可惜LinkButton是链接,不过我们可以用CSS将其外观改为按钮样式! 最后一种方法就是不用服务器端控件,将Button改为,一样在CheckForm1中改变表单action属性也是可以的。
👤 博主
📅 2008-04-02
👁 7512
👍 0
📂 Web编程
阅读全文 →
<%@ Page Language="VB" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Net" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.HttpPostedFile" %>
<%@ Import Namespace="System.Web.UI.HtmlControls.…
👤 博主
📅 2008-04-02
👁 7964
👍 0
📂 Web编程
阅读全文 →
A protocol is a method that is used to send, receive, and handle information over a connection. Common protocols viewed from the browser include http, https, ftp, and mailto. In order for you to view information sent over a specific protocol, it must be registered. If you enter a URL for an unknown protocol (foo) in the Location Bar, you will receive a message such as, Firefox doesn't know how to open this address, because the protocol (foo) isn't associated with any program or, in Mozilla Suite/SeaMonkey, foo not a registered protocol. Once registered, the protocol can then be handled by the program you specify, such as your browser or a third party viewer. This means that a hyperlink ( e.g. foo://fred) can use the handler for protocol foo to open the file named fred. Windows…
👤 博主
📅 2008-03-31
👁 8048
👍 0
📂 Web编程
阅读全文 →
The About Asynchronous Pluggable Protocols article describes how to develop handlers for new protocols. In some cases, it may be desirable to invoke another application to handle a custom protocol. To do so, register the existing application as a URL Protocol handler. Once the application has successfully launched, it can use command-line parameters to retrieve the URL that launched it. 文章《About Asynchronous Pluggable Protocols》(中译关于“异步可插协议”(About Asynchronous Pluggable Protocols(APPs)))描述了如何为一个新的协议开发处理程序(处理器handlers)。在一些案例中,可能会描述如何调用另外一个应用程序来处理自定义协议(custom protocol)。注册已经存在的应用程序为一个URL协议处理器即可。一旦应用程序被成功地启动,我们可以使用命令行参数来重新找回URL来启动它。 ·Registering the Application Handling the Custom Protocol…
👤 博主
📅 2008-03-31
👁 8737
👍 0
📂 Web编程
阅读全文 →
using System;
using MSXML2;//引用COM:Microsoft XML, v3.0
namespace ConsoleApplication1
{
class Program
{
static void Main(string args)
{
XMLHTTP xmlhttp = new XMLHTTP();
string url = "http://www.mzwu.com/";
xmlhttp.open("GET", url, false, null, null);
xmlhttp.send("");…
👤 博主
📅 2008-03-28
👁 6384
👍 0
📂 Web编程
阅读全文 →
<%
Class Image
Private oStream
Public ImgW,ImgH
Private Sub Class_Initialize
Set oStream=CreateObject("Adodb.Stream")
oStream.Mode=3
oStream.Type=1
oStream.…
👤 博主
📅 2008-03-28
👁 8171
👍 0
📂 Web编程
阅读全文 →
使用此类可实现生成缩略图、漫射效果、棕褐色调 (老照片)效果、锐化效果、黑白效果和灰度效果。
👤 博主
📅 2008-03-26
👁 6222
👍 0
📂 Web编程
阅读全文 →
/// <summary>
/// 将字符型类型转换为整型值
/// </summary>
/// <param name="objValue">字符型</param>
/// <param name="defaultValue">无法转换时的默认值</param>
/// <returns>整型值</returns>
public static int IntParse(string objValue, int defaultValue)
{
int returnValue = defaultValue;
if (!string.…
👤 博主
📅 2008-03-26
👁 7722
👍 0
📂 Web编程
阅读全文 →