转到正文

存档

分类: ASP.NET

Problem

You are coding away on an ASP.NET page, and are trying to isolate a problem within the page.  You have some existing html/controls/markup/in-line code that is being used on the page, and you want to temporarily comment it out while you fix the problem.

Solution

ASP.NET supports a little known feature called “server-side comments” that you can use to completely disable code/controls/html in a page.  Server-side comments in ASP.NET are delimited using a <%-- --%> syntax.  For example:

        
<%--

Commented out HTML/CODE/Markup.  Anything with  this block will not be parsed/handled by ASP.NET.

<asp:Calendar runat="server"></asp:Calendar> 

<%# Eval(“SomeProperty”) %>     

--%>

继续阅读

Error description:

I write a ASP.NET program, I use HttpContext.Current.User.Identity.Name to store users which visit our site. This program runs well when I debug in Visual studio and wee get display the login user successfully. However, the user name cannot be displayed when I run it in IIS 7.0. I'm very confused, why the program runs well at VS but fail at IIS?

Solution:

It's very obviouly that your IIS cannot get the username for the login one. It's because that you enable the anonymouos authentication in your IIS.  You should follow some steps as follows:

Firstly, open you IIS confiuation, Open "Authentication" in "IIS" folders. Just like:

  继续阅读

These days I meet a very strange error: I wirte a ASP.NET program and deploy it well in my computer(server in china), however, this program get some errors when runs in remote computer(server in American).

The phenomenon of this error is that we input a datetime as parameter to SQLserver, and we always get none dataset results. The code of this datetime parameter like as follows:

paraTime.ToString("yyyy/MM/dd")   // c# code

we convert the time to be String like "2010/01/01"  and then input the string to SQL server. In this circumstance, we can get results from chinese server but not american serrver. Why?

I debug it, when I input "2010/01/01"  in chinese server computer, it runs well but fails  int american server computer. I try to modify the code to be:

paraTime.ToString("yyyy-MM-dd")   // c# code

继续阅读

www.liaoqiqi.com网站PR查询 博客简洁版 博客Google_Site_Map 博客Baidu_Site_Map ?