Home Contact RSS

Oy kullanın!

Eğer siz de ImagineCup Mısır 2009′da oy kullanmak isterseniz http://peopleschoice.imaginecup.com/default.aspx adresini ziyaret edebilirsiniz.

Türkiye’nin de bir projesi olduğunu da hatırlatmak isterim.

Web Deployment with VS 2010 and IIS

Visual Web Developer Team posted an interesting post on their blog today. It gives a short description of how web deployment scenarios will be handled in Visual Studio 2010. Of course including deployment of database, IIS settings and transformation of the Web.config file.

Personally, I am really excited to see these features in VS 2010. It will definitely be better than FTP deployment because it will be able to handle a lot of scenarios like IIS settings, web.config changes depending on the environment (release, debug, staging, production, etc.), database changes, GAC, etc. If you want, you may go ahead and give it a try, it is a Beta 2 release though.

P.S.: Currently, only web application projects are supported. According to the team, they are considering to support web site projects and pre-compilation scenarios in the future.

You may read the complete post here.

ASP.NET MVC final version is on its way to be released soon, RC is already ready to be downloaded!

Most of us have been waiting for ASP.NET MVC to get to its final release so we can use it in our projects. The main reason to do that is because until it is in its Release Candidate version, its features are subject to change at anytime. However, that was until yesterday. Now its Release Candidate version is public and can be downloaded by clicking this link and also you can see its release notes by clicking this link.

Good news is that ASP.NET MVC’s final version will be released next month, in February 2009.

Some important changes might be listed as below.

  • “Create Controller” action in Visual Studio context menu in Solution Explorer.
  • “Add View” action in Visual Studio context menu inside an Action method’s body. This will let you create an empty View or a View that has been specially created for the type that is being passed as a parameter to the View. E.g.: return View(user) will create a basic View that has “user” entity’s type’s properties.
  • Ability to customize any kind of templates being used by MVC using T4 (Text Template Transformation Toolkit) – further reading. Both machine-wide and project-wide!
  • RC release now includes a out of the box MSBuild task so you can compile the views within your ASP.NET MVC project.
  • Views can work without Code-Behind files. You can still use the advantages of strongly typed base type. E.g.: Inherits=”System.Web.Mvc.ViewPage<MyCustomType>”
  • To access the Model’s data, you don’t need to use “ViewData.Model” anymore. “Model” is a top-level property from now on. “ViewData.Model” still works though.
  • An out of the box MSBuild task is included in the setup if you want to compile the code within the views.
  • You are not required to use Bind attribute with Prefix value set to an empty string [Bind(Prefix="")] by the default behavior.
  • Supports protection to “Cross-site request forgery” attacks with an out of the box attribute: ValidateAntiForgeryToken. You may apply this attribute to the actions that you want to protect.
  • FileResult (an out of the box ActionResult) to response a file instead of some other views using an action. Also there is the new File() method to create and return a file.

Visit http://www.asp.net/mvc for more details.

Internet Explorer 8 RC 1 has just been released!

To download the 1st Release Candidate version of Internet Explorer 8, visit http://www.microsoft.com/windows/products/winfamily/ie/ie8. To read more about this version and what has been changed since version Beta 2, please see the blog post here.

ASP.NET MVC Design Gallery

For those who needs ASP.NET MVC compatible, free and ready to use templates; don’t forget to check out the new gallery at http://www.asp.net/mvc/gallery/default.aspx.

HttpPostedFile.FileName browser dependent behaviour

Even though these kind of variables must have some standards (may be it already has), there are differences in practise. Be careful with the FileName property of HttpPostedFile class when you want to work on a file being uploaded by visitors of your page because the FileName value that you will get on Internet Explorer and Firefox are different.

If your visitor uses Internet Explorer, you will get the local path to the file. E.g.: C:\somefile.txt. However, if your visitor uses Firefox, the FileName value that you will get will be only the file’s name. E.g.: somefile.txt.

To avoid problems, you may have the following check.

string filename = postedFile.FileName;
if (filename.IndexOf('\\') > -1)
{
    filename = filename.Substring(filename.LastIndexOf('\\') + 1);
}
else if (filename.IndexOf('/') > -1)
{
    filename = filename.Substring(filename.LastIndexOf('/') + 1);
}

Extension methods don’t compile? No panic!

I came across to a really strange problem today. Some extension methods that I have copied from another project just did not want to be compiled at all.

’string’ does not contain a definition for ‘MethodName’.

I have checked everything, including clearing the temporary ASP.NET files within framework folder (C:\Windows\Microsoft.NET\Framework\…), restarting Visual Studio and even restarting the OS. The target framework of the projects were all set to 3.5 as well. But unfortunately, nothing helped. Finally, when I compared what kind of configuration I could be missing from web.config, I have found out the missing (and the killer) part.

If you have a similar problem, try adding the following configuration section in your project’s web.config file.

  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
  </system.codedom>

Some useful UpdatePanel extensions

I want to share some pretty basic and useful UpdatePanel control extensions with you. Method names are self explaining so I will not go deep in details.

public static void AlertOnLoad(this UpdatePanel updatePanel, string key, string message)
{
    message = message.Replace("'", "\'").Replace("\r\n", "").Replace("\n", "");
    message = "alert('" + message + "');";
    AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(updatePanel, updatePanel.GetType(), key, message, true);
}

public static void RedirectOnLoad(this UpdatePanel updatePanel, string key, string url)
{
    url = "top.location.href = '" + url + "';";
    AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(updatePanel, updatePanel.GetType(), key, url, true);
}

public static void OpenWindowOnLoad(this UpdatePanel updatePanel, string key, string url)
{
    url = "window.open('" + url + "');";
    AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(updatePanel, updatePanel.GetType(), key, url, true);
}

Team System Web Access Language Packs Are Ready!

Community made a great job this month. Microsoft MVPs have localized Team System Web Access (TSWA) into 7 new languages. With support of Microsoft Turkey, Hakan Eskici (TSWA Program Manager), Tufan Erdinc, we have built the Turkish language pack. The full list of language packs are below.

To download any of the language packs that you are interested in, visit Team System Web Access Localization Project on CodePlex.

How to generate RSS feeds without any 3rd party components

RSS feeds are widely used in today’s internet world. Thus we, developers, have to implement it on our websites and projects most of the time. There are many free and paid components that generates RSS feeds but in fact you may generate it by yourself as well.

I will post a generic handler’s source code to show you how to do that.

Post is a class that has some basic properties like Url, Title, Teaser, etc. You may need to write your own class and implement these properties in a basic manner. Then you will need to create a GetPosts() method that returns a list of Post objects.

Read the rest of this entry »

Next entries »