ASP.NET
ASP.NET
I have a single page(created before Master pages were available) that loaded dynamically one or another user control.Some child controls have css for quirk mode, but for new controls I want to use latest DocType <!DOCTYPE html> The solution is to set it dynamically in code-behind depending on current control to load(the code is copied from http://stackoverflow.com/qu... =========aspx=============== <%@ Page Language="C#"...
We have a webscraper ASP.Net application, that worked fine on developers and test environments, but didn’t work on some machines with more strict security settings. HttpWebRequest failed with System.Net.WebException: Unable to connect to the remote server It start working when my colleague added the site that application tried to access to his “Trusted Sites” zone using Internet Explorer. What we couldn’t understand, how it affected an application that ran under DIFFERENT account. I didn’t find any...
String Resources For string resources we will use local/global resources connecting to DB using DbResourceProvider from “Creating a Data Driven ASP.NET Localization Resource Provider and Editor” http://www.west-wind.com/pr... It also has DbResourceControl, that shows controls with Localizable attribute and connect them to editor. From http://guysmithferrier.com/... and http://www.guysmithferrier....
I’ve read Combining Client Scripts into a Composite Script and wanted to use it. Then I’ve read Julian Jelfs concerns ScriptManager.CompositeScript issues However the article Combining javascript files with Ajax toolkit library describes workarounds, that make the solution workable. You also can use Script reference profiler: http://aspnet.codeplex.com/... Related posts: Using ScriptManager with other frameworks MSDN documentation: CompositeScriptReference The older implementations,...
We’ve noticed in event log the following error: Message : A potentially dangerous Request.Path value was detected from the client (:). Type : System.Web.HttpException, System.Web, Version=4.0.0.0, Culture=neutral, Message : A potentially dangerous Request.Path value was detected from the client (:). Source : System.Web WebEventCode : 0 ErrorCode : -2147467259 Stack Trace : at System.Web.HttpRequest.Vali... at System.Web.HttpApplication....
We’ve used HtmlAgilityPack based function IsValidHtmlFragment(string html) to validate dynamically loaded Html Fragments before inserting into main page(or do not insert if it is invalid) and recently noticed that it doesn’t return false for some fragments with not closed tags. I decided to find some other tool to call from the code and found that most of HTML parcers are too forgivven(like browsers) or too strict- to check full XHTML conformance. I am going to add manual procedure to run Tidy.EXE...
I've recently added to my UriHelper class the function RemoveQueryStringFromUrl public static string RemoveQueryStringFromUrl(st... url) { //similar to string qs = QueryStringHelper.QueryStri... string urlPath = url.LeftBefore("?"); return urlPath; } It refers to methods from My QueryStringHelper class and My StringHelper class...
I've attended Australian Remix10 and below is a list the points, that I've learned and/or want to read more about. The materials of US MIX10 conference are here http://live.visitmix.com/ Windows Azure ( pronounced [azh-er] http://dictionary.reference... - sounds great from hosting costs/redundancy, but how much work is required to change existing asp.net application with SQL backend to support Azure. http://www.azuresupport.com...
Recently we upgraded Web Farm web site to ASP.Net 4. We studied .NET Framework 4 Migration Issues and, fortunately, didn't found any serious issues, related to our site. Before all sites will be converted to .Net 4, for forms authentication cookies to work across .NET Framework versions, we've added <system.web> <machineKey validation="SHA1" /> </system.web> Tests were successfull on single computer, but when we started to test new version on Web Farm, we started to see intermittent...
There are couple methods recently added to My DateTimeHelper class public static DateTime StartOfMonth(this DateTime dateValue) { return new DateTime(dateValue.Year,dat... } public static DateTime StartOfNextMonth(this DateTime dateValue) { return StartOfMonth(dateValue).Add... }...
I've created my own version of UnhandledExceptionModule independantly of codePlex project in 2007, I've used code from http://support.microsoft.co... with considerations from http://www.eggheadcafe.com/... and done some refactoring. It also allows to use AppSettings["EventLogSource... The zip file also includes TestUnhandledExceptionWAP test project, that I used to investigate issue legacyUnhandledExceptionPolicy enabled="true" doesn't prevent ASP.NET application restarting...
I've attended DDD Melbourne and want to list the interesting points, that I've learned and want to follow. To read more: * Moles-Mocking Isolation framework for .NET. Documentation is here. (See also Mocking frameworks comparison created October 4, 2009 ) * WebFormsMVP * PluralSight http://www.pluralsight-trai... * ELMAH: Error Logging Modules and Handlers Great for new sites or sites without error logging/monitoring. However if you site already have working error...
/// <summary> /// Redirects parent of IFrame to specified URL /// If current page doesn't have parent, redirect itself /// </summary> /// <param name="page"></param> /// <param name="url"></param> public static void NavigateParentToUrl(Page page, string url) { String script = @" try { var sUrl='" + url + @"'; if (self.parent.frames.length != 0) self.parent.location=sUrl; else self.location = sUrl; } catch (Exception) {} "; page.ClientScript.RegisterS...
Comment in JS code doesn't comment the server command. It is correct, but can be visually confusing. I had the following line in markup ASCX file. // var trs = document.getElementById('&l... %>').getElementsByTagNam... Visual Studio showed it as green comment. However when server control pnlOutsideSearch was renamed, the errors were generated, and it took me some time to realize, what wrong with the line, tha it was look like just comment...
Validators are disabled, if they are not visible. They can be not visible, if any of their containers is not visible. In general, they should be always visible, but the message will be shown only if they will be NOT valid. Also consider to set BaseValidator.SetFocusOnErr... In big pages use ValidationGroup combined with CausesValidation property set to true...
When ASP.NET page converted to WAP, it changed autoeventwireup to True- see autoeventwireup Changed to True in C# Conversion to WAP discussion. Autoeventwireup is easier for coding, but there are disadvantages(according to MSDN): One disadvantage of the AutoEventWireup attribute is that it requires that the page event handlers have specific, predictable names. This limits your flexibility in how you name event handlers. Another disadvantage is that performance is adversely affected, because ASP.NET...
More than a year ago I wrote a post Code Render Blocks does not work inside HEAD server controls about the problem, that prevented me to update URL of CSS file, when version of assembly incremented. Now I've created a function /// <summary> /// /// </summary> /// <param name="page"></param> /// <param name="cssFileHref">e.g. "~/StyleSheet.css"</para... /// <returns></returns... public static HtmlLink AddStyleSheetLink(this Page page, string cssFileHref)...
I need to show popup info message with single close button, but content is located in separate html file. The current implementation using window.open not working for many users with popup blockers. My question is which tool/framework should I use. Initially I considered to use UFrame (see CodeProject article:UFrame: goodness of UpdatePanel and IFRAME combined )inside ASP.NET AJAX ModalPopup. Then I found question http://stackoverflow.com/qu...
The Web Service Provider that we are using recommends NOT send Expect100Continue header. The specifying static value System.Net.ServicePointMana... is not good, because some other providers may prefer to use the header. In the haacked's "HttpWebRequest and the Expect: 100-continue Header Problem" post comment of Mirronelli Jun 02, 2005 6:22 AM suggest to specify webRequest.ServicePoint.Exp... = false; for each webRequest. If I am using web service(derived from...
12 Steps To Faster Web Pages With Visual Round Trip Analyzer recommends (among others useful suggestions) to Set Expiration Dates - follow Using Content Expiration (IIS 6.0), . I've looked in a few articles, including Best Practices for Speeding Up Your Web Site, "Optimizing a Page-Load Performance Profile and Optimization of a Web Site - Using Content Expiration (IIS 6.0) . Finally the post IIS Content expiration header and ASP.NET cleared my concerns: IIS is smart enough to add the expiration header...
Full ASP.NET Archive