Team Foundation Server On Cloud
My company started to use Team Foundation Service, which is the Team Foundation Server On Cloud. That is free to use up to 5 Users for each project.
I found that is useful for us. That saves the administration effort to manage a Team Foundation Server in our Office and save the cost of hardware. All Server Load goes to Microsoft. In additional, we can always use the latest version of Team Foundation Server. We do not need to worry about upgrading the software and install the patches. Lastly, it has a nice interface for Agile Development. We can create the user stories and do the sprint planning. That is so great! I highly recommend this.
P.S. It support GIT. We started to use it for our PHP projects too.
WebGrid is great!
I used a lot of opensource grid control, such as PagedList.Mvc. They are great! But I found they are not working with Ajax very easily! But I found MVC3 has a default Grid control calls, WebGrid. It work perfectly with Ajax. You just need to say the gird name in "ajaxUpdateContainerId".
Code
var grid = new WebGrid(Model.result, defaultSort: "StudentId", rowsPerPage: 100, ajaxUpdateContainerId: "grid"); |
In the area you need to display the gird
Code
@grid.GetHtml() |
That is easy!!!
If you are using MVC3, you can save your time to look for third party control.
The installer is built in AdvGenCMS
Finally, we built an installation program for AdvGenCMS. Now, you only need to open the solution and publish the AdvCMS folder. Then you create the database and assign a user with db_owner role. Finally, please run the website and fill in the details.
Edit Connection String in code and save into web.config
I am building an installer for my CMS, AdvGenCMS. The first part is adding connection string and saves it into web.config. That is doable in C#. Just like the following code:
Code
Configuration config = WebConfigurationManager.OpenWebConfiguration("~"); | |
ConnectionStringsSection connectionStrSection = config.GetSection("connectionStrings") as ConnectionStringsSection; | |
string conntectStr = String.Format("data source={0};Initial Catalog={1};uid={2};password={3};Intergrated Security=SSPI",serverModel.ServerName,serverModel.DatabaseName,serverModel.UserName,serverModel.UserPassword); | |
if (connectionStrSection != null) | |
{ | |
if ( connectionStrSection.ConnectionStrings["AdvCMS.Data.Linq.Properties.Settings.AdvCMSConnectionString"] == null) | |
{ | |
ConnectionStringSettings setting = new ConnectionStringSettings(); | |
setting.Name = "AdvCMS.Data.Linq.Properties.Settings.AdvCMSConnectionString"; | |
connectionStrSection.ConnectionStrings.Add( | |
setting); | |
} | |
connectionStrSection.ConnectionStrings["AdvCMS.Data.Linq.Properties.Settings.AdvCMSConnectionString"].ConnectionString = conntectStr; | |
connectionStrSection.ConnectionStrings["AdvCMS.Data.Linq.Properties.Settings.AdvCMSConnectionString"].ProviderName = "System.Data.SqlClient"; | |
config.Save(); | |
} |
We can use WebConfigurationManager.OpenWebConfiguration("~") to get the whole configuration and then use config.GetSection("connectionStrings") to get the connection string section. Now, we can play around the connection string section freely.
HttpRequestValidationException in Request.Form
I am writing a CMS in C# and a html editor in the asp.net page. Therefore, I got some HTML code in Request.Form Object. Last night, I found the problem. I got HttpRequestValidationException when I save a html content. That is safe by rejecting any post variables has html code. So, I tried the used [ValidateInput(false)] in the controller, that is not working. Finally, I found I need to turn off that globally in web.config
Code
<httpRuntime requestValidationMode="2.0" /> | |
<pages validateRequest="false"> |
Please remember to use <httpRuntime requestValidationMode="2.0" /> for switching the validation mode into 2.0, unless just turn off validate request is not enough!