วันอังคารที่ 29 ธันวาคม พ.ศ. 2552

IIS7 and old asp problem

Yesterday i need to set some asp application on IIS7 (Vista)
and found something (I already install asp component)

If asp have error occur it doesn't show error message and tell me to contact administrator (that's me)

"An error occurred on the server when processing the URL. Please contact the system administrator"

for this go to setting error to show go to root web sites (don't know why set per application not work)
setting in asp
Send Errors To Browser = true

yes after this i see error but it confuse me more
with this word

Active Server Pages error 'ASP 0131'

Disallowed Parent Path

/default.asp, line 1

The Include file '../header.inc' cannot contain '..' to indicate the parent directory.

What this mean yes after research i found IIS7 don't allow parent path for asp by default.
um again.

go to asp setting and set
Enable Parent Paths = true

Yes after this you will see real error come true.

you can use trace your application by Failed Request Tracing Rules for another options about this

วันศุกร์ที่ 25 ธันวาคม พ.ศ. 2552

Break And Continue in loop?

for(int i = 0; i < 10; i++){
if(i == 0) break;
DoSomeThing(i);
}

for(int i = 0; i < 10; i++){
if(i == 0) continue;
DoSomeThing(i);
}

From above code is simple to explain

break is complete stop and exit loop
continue use to stop current loop but can continue to next loop

วันพุธที่ 23 ธันวาคม พ.ศ. 2552

asp:menu problem render with IE8

It will not render correctly until you use Compatible mode to see it work again.
This is bug from ASP.NET not IE 8 and it already have fix patch for this

For more details go here.
http://blogs.msdn.com/giorgio/archive/2009/02/01/asp-net-menu-and-ie8-rendering-white-issue.aspx
and
http://support.microsoft.com/kb/962351

Fix for Windows XP, Windows 2000, Windows Server 2003
http://code.msdn.microsoft.com/KB969612

for Vista and Windows 2008
http://code.msdn.microsoft.com/KB967535

วันพฤหัสบดีที่ 10 ธันวาคม พ.ศ. 2552

If Condition inline in GridView

<ItemTemplate>
<asp:LinkButton ID="uxEditLinkButton" runat="server" CommandName="Edit"
Text="Edit"
Visible='<%# (Eval("PageID").ToString() == "0")? false : true %>'></asp:LinkButton>
</ItemTemplate>

This sample show easy how to hide edit link if PageID == "0" by use condition inline in ItemTemplate for any GridView.

Insert Condition inline in GridView Template

(ItemTemplate>)
(asp:LinkButton ID="uxEditLinkButton" runat="server" CommandName="Edit"
Text="Edit" Visible='(%# (Eval("PageID").ToString() == "0")? false : true %)')(/asp:LinkButton)
(/ItemTemplate)