Getting 404.0 error for ASP.NET MVC 3 app on IIS 7.0 / Windows Server 2008

You actually just reminded me that I needed to fix this issue in an enviroment here. If your situation is the same as mine then it’s a simple fix. Just add the following to your web config: <system.webServer> <modules runAllManagedModulesForAllRequests=”true” /> Edit: To provide further explanation on the issue at hand. In my case what … 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

The directory ‘/website/App_Code/’ is not allowed because the application is precompiled

Depending on your case, there are three possible scenarios: see this link http://www.beansoftware.com/ASP.NET-FAQ/Directory-App_Code-Not-Allowed.aspx Basically, If you precompiled your app, there shoudn’t be an App_Code folder. If you added it later, you should delete it. OR May be Somehow a precompiled.config file has made it to production. Deleting that file should resolve the App_Code directory error.

ASP.NET control to render a

Of course: ASP.NET has a built-in control called Panel! And you may use it as follows: <asp:Panel ID=”myPanel” runat=”server”> <!– Other markup here like client and server controls/elements –> </asp:Panel> It’s a container, so you add Controls to it in the code-behind like: myPanel.Controls.Add(new LiteralControl(“Hello World”)); You can add the Literal control (or any others) … 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

tech