Replace default IPrincipal object in ASNET

There is an easy way to override or provide IPrincipal object exposed by the System.Web.UI.Page.User property. Implement OnAuthenticate handler in the Global.asax public void WindowsAuthentication_OnAuthenticate(Object Source, WindowsAuthenticationEventArgs e) { e.User = new GenericPrincipal(e.Identity, new string[] {„Role1”, „Role2”, „Role3”}); } This way you do not have to implement RoleProvider class, just …

How to format each GridView row based on data-item

Every now and then, someone requests that a html table with should somehow be customised based on data shown, for eg. each row should have different background color for each „Status” column in data-item. In my knowledge there is no easy way of doing it declarative in ASP.NET using standard …

Simple re-use of QueryString paremetr with BindableHyperLink

When you want to use a query parameter passed to your page you’ll need litle bit of extra coding. There are few ways to accomplish that but in simple cases I like to use data binding expression just inside NavigateUrl attribute on Hyperlik’s and friends: <wc:BindableHyperLink ID=”newItem” runat=”server” Text=”Add” NavigateUrl='<%# …

ASP.NET ignores /configuration/system.web/authorization settings

A while ago, my ASP.NET 2.0 application seemed to ignore /configuration/system.web/authorization setting and authorised everyone to have access, while it should not. Application was deployed on IIS 6.0 (Windows 2003 Standard SP), with customised application pool with domain user as app pool identity. Impersonalization was off. What was strange during …

Unable to generate a temporary class (result=1)

A precompiled ASP.NET 2.0 application (with web services) running in custom domain service account sandbox on IIS 6.0 (Windows 2003 Standard SP1). A service account is in IIS_WPG group so everything concerning required rights should be covered. When a request comes form a browser it works OK, cause the application …

No authority could be contacted for authentication.

Another Kerberos/IIS issue. Today one of my web applications stopped working, giving me the: No authority could be contacted for authentication, message. When I tried to access the web application from IIS MMC snap-in through browse, I received a different error: SystemException: The trust relationship between this workstation and the …

Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection.

Another of „It should just work” problems… resulting in: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. Number: 18452 Procedure: State: 1 Severity: 14 LineNumber:0 System.Data.SqlClient.SqlException : Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, …

Back to Top