Font awesome inside asp button

You can’t with the default asp.net button you will need to use a HTML button and give it runat=server attribute: <button runat=”server” id=”btnRun” class=”btn btn-mini” title=”Search”> <i class=”icon-camera-retro”></i> Search </button> So use code behind with this you add: onserverclick=”functionName” To the button, then in your C# do: protected void functionName(object sender, EventArgs e) { Response.Write(“Hello … Read more

Check if Cookie Exists

Sometimes you still need to know if Cookie exists in Response. Then you can check if cookie key exists: HttpContext.Current.Response.Cookies.AllKeys.Contains(“myCookie”) More info can be found here. In my case I had to modify Response Cookie in Application_EndRequest method in Global.asax. If Cookie doesn’t exist I don’t touch it: string name = “myCookie”; HttpContext context = … Read more

how to remove ‘name’ attribute from server controls?

create a Filter (class that inherits from Stream), assign it to your HttpContext.Response.Filter attribute, and in it you would overwrite the Write method, to remove all the name-tags from the generated html 🙂 See this page for more information http://msdn.microsoft.com/en-us/library/system.web.httpresponse.filter.aspx Update Looking at the sourcecode for TextBox it reveals that Name is actually added to … Read more

I need a fast runtime expression parser

Have you seen https://ncalc.codeplex.com/ and https://github.com/sheetsync/NCalc ? It’s extensible, fast (e.g. has its own cache) enables you to provide custom functions and varaibles at run time by handling EvaluateFunction/EvaluateParameter events. Example expressions it can parse: Expression e = new Expression(“Round(Pow(Pi, 2) + Pow([Pi2], 2) + X, 2)”); e.Parameters[“Pi2”] = new Expression(“Pi * Pi”); e.Parameters[“X”] = … Read more

An attempt to attach an auto-named database for file ….database1.mdf failed

I had this problem also and it was a pain. I configured my connection string and managed to solve the problem. In the connection string I replaced the value |DataDirectory|\dbfilename.mdf for AttachDbFilename property, with the path to the file. |DataDirectory| can only be used if the database file is in the App_Data folder inside same … Read more

How should I perform a long-running task in ASP.NET 4?

Preferentially, avoid having long tasks executing in such an environment. Delegate long running tasks out to a stable system service via interoperability, leaving the web application responsive and only required for direct user requests. Web applications have never been (and still aren’t) considered reliable systems – anyone who has ever used a browser has encountered … Read more