It’s so easy to use powerful ASP.NET Membership, Role and Profile provider in a Windows or Console application. Only one key point remains here; you should add an app.config file to your Console or Windows application and include these nodes in that:

<?xml version='1.0' encoding='utf-8'?>
<configuration>
    <connectionStrings>
        <add name="SQLConnString" connectionString="SERVER=(local);DATABASE=SampleApp;UID=sa;PWD=123"/>
    </connectionStrings>
    <system.web>

        <membership defaultProvider="SampleAppMembershipProvider">
            <providers>
                <add name="SampleAppMembershipProvider"
                     connectionStringName="SQLConnString"
                      applicationName="SampleAppMembership"
                      enablePasswordReset="true"
                      enablePasswordRetrieval="false"
                      passwordFormat="Hashed"
                      maxInvalidPasswordAttempts="100"
                      minRequiredPasswordLength="5"
                      minRequiredNonalphanumericCharacters="0"
                      requiresQuestionAndAnswer="false"
                      requiresUniqueEmail="true"
                      passwordAttemptWindow="5"
                      passwordStrengthRegularExpression=""
                      type="System.Web.Security.SqlMembershipProvider" />
            </providers>
        </membership>

        <profile defaultProvider="SampleAppProfileProvider">
            <providers>
                <add name="SampleAppProfileProvider"
                type="System.Web.Profile.SqlProfileProvider"
                connectionStringName="SQLConnString"/>
            </providers>
            <properties>
                <add name="FirstName" type="System.String" />
                <add name="LastName" type="System.String" />
                <add name="Email" type="System.String" />
                <add name="Website" type="System.String" />
                <add name="Address" type="System.String" />
                <add name="Note" type="System.String" />
                <add name="Phone" type="System.String" />
                <add name="Fax" type="System.String" />
                <add name="Feature" type="System.Int32" />
            </properties>
        </profile>

        <roleManager enabled="true" cacheRolesInCookie="true" defaultProvider="SampleAppSqlRoleProvider" 
cookieName=".ASPXSampleAppROLES" cookiePath="/" cookieTimeout="30" cookieRequireSSL="false"
cookieSlidingExpiration="true" createPersistentCookie="false" cookieProtection="All"> <providers> <clear/> <add name="SampleAppSqlRoleProvider" type="System.Web.Security.SqlRoleProvider,
System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

connectionStringName="SQLConnString" applicationName="SampleAppRoles"/> </providers> </roleManager> </system.web> </configuration>

 


Categories: .NET General | ASP.NET | Security

October 3, 2007
@ 02:07 PM
Omar Al Zabir has recently listed 10 cool articles about ASP.NET, AJAX, ... which he has published this year. From my personal view these articles are interesting:


 


Categories: .NET General | AJAX | ASP.NET | Security | Web | Web 2.0 | Web Development

October 1, 2007
@ 01:54 PM
BlogEngine.NET 1.2 released. As you may know it's a free blog tool written in C# and ASP.NET 2.0 and they added many features to this release which you can see here.

In this release BlogEngine supports 26 language packages including Persian language which I had translated its resources for them.

Although, I don't use BlogEngine at present (and I'm using dasBlog), I'm thinking about migration to BlogEngine because of more features. In this version BlogEngline also supports BlogML for import/export (Thanks Keyvan!).

More on BlogEngline.NET: Download Latest Release | Documents | Hosters that offer BlogEngine.NET | Complete Features List | Some Videos.


 


Categories: .NET General | ASP.NET | Download

It's a few months I have been using UrlRewriting.NET component for my Url Rewriting needs in ASP.NET 2.0. Since it's free and open source and covers many features that I need, it was a good choice for my projects. The big problem with this (and also other available components) is that it can't rewrite fake directories. For example if you have a url like http://myurl.com/products/productcategory.aspx?name=Phone and want to rewrite it to something like http://myurl.com/products/Phone/ you must have a folder named Phone in products folder containing a blank Default.aspx file inside it or in another way map all requests to ASP.NET engine in IIS. Both ways (especially second) are annoying and waste resources.

Because I'm working on a project that needs to rewrite fake URLs and also server resource management is so important in this project I searched for other solutions today and I reached UrlRewiter.NET; but unfortunately this one doesn't support fake URL rewriting as well as previous ones. [There are some tricks to handle fake directories like using customErrors default error page and etc. which you can find on CodeProject.com]. So it is not a good solution for me too. So I searched again and I reached this. It seems that IIS 7.0 new structure lets developers do this. In fact just by adding a few lines to Web.Config you can use your current module to Rewrite all URLs (See this post).

It's a good news but IIS 7.0 is still in Beta and many servers don't support it. Should we wait until Windows Server 2008 to use IIS 7.0?

It's a big question for me that while PHP developers are using this simple feature since a few years ago, why Microsoft don't offer a solution before IIS 7.0 official release.

UPDATE 1: Looking for IIS 6.0 Solutions? See this.
UPDATE 2: Wyatt Barnett has commented on this post and introduced an article written by himself which explains some tricks to make IIS 6.0 Play With UrlRewriting. See it.



 


Categories: .NET General | ASP.NET | Web Development

September 17, 2007
@ 04:44 PM
Today I found an article on ASP.NET official website introducing a custom control to show weather on your website.

Milan Negovan has talked about his control and features in this article. I know it's two easy to write some lines of code to use a customized RSS feed from Yahoo! Weather (RSS example for Tehran current weather) or other websites and display it in an appropriate format in our websites, but as a ready-to-use tool you can just download this control and drop it in your client projects as an extra feature! Before download you can see a live demo here.

For those who want to challenge more with technical issues: This article describes how to use NOAA Weather WebService to show a customized look weather report.


 


Categories: .NET General | ASP.NET | Download | Web Services

September 16, 2007
@ 04:38 PM
asp.netPRO Magazine recently published 3 latest issues in PDF format as a free download. You can download July, August and September issues here.


 


Categories: .NET General | ASP.NET | Download

August 26, 2007
@ 03:35 PM
Scott Hanselman, like past years, introduced a 2007 list of developer and power users tools for Windows. If you are familiar with his cool lists you can enjoy his fresh 2007 version of it and if you didn't hear anything about his list before its time to take a look at it.

In addition to those tools I've ever been using, I downloaded these tools in my first look at list and I will read list exactly later!: Query Express, CollectionGen, Code Style Enforcer, Microsoft BPA, Resource Refactor.

Thanks Scott, you are an angel!


 


Categories: .NET General | ASP.NET | Download | Software | Web Development | Tools

May 3, 2006
@ 04:12 PM
Microsoft released beta 1.1 version of CSS friendly ASP.NET 2.0 control adapters Beta 1.1. This is a free tool let you force your server side controls render html output as you like based on CSS technology. As is read on its web site:

"ASP.NET is a great technology for building web sites but it would be even better if it rendered different HTML. For example, the Menu control makes it simple to add a menu to a web site but it would be better if it didn't create <table> tags and was easier to style using CSS. Happily, it's easy to "teach" the Menu control how to generate the kind of HTML that you prefer. Indeed, you can modify any ASP.NET control so it produces better HTML.

The key is to use something that may be new to you: control adapters. These are little chunks of logic that you add to your web site to effectively "teach" an ASP.NET control how to render better HTML."

You can download it for ASP.NET 2.0 here. Also you can find a complete guide and some live examples here.


 


Categories: ASP.NET | Download | Microsoft | Web Development

Keyvan started to localize Community Server for Persian language and some other Iranian .NET developers joined him so far. They have registered CommunityServer.ir domain name for this project and this web site is a bit active now and will be expanded in the upcoming days.

Read more about it on Keyvan's post. As I know this project is sponsored by DataNet Company.

I may join them if I can.

UPDATE: I joined the team!


 


Categories: ASP.NET | Community Server Persian | i18n | Iran

March 1, 2006
@ 01:49 PM
Microsoft released Anti-Cross Site Scripting (XSS) Library V1.0 for .NET framework [Details]

I think after SQL Injection, XSS is the second vulnerability which many web sites are infected to and so this tool can help (and awake!) many developers control this danger in their codes.

As said on download page of this library, current downloadable package only contains .NET 2.0 binaries and 1.x versions are due to release in future (Bad news :(( I still have to use 1.x version in some projects).

More information about XSS can be found here.

UPDATE: Library updated! Now it supports both .NET 2.0 and 1.x.


 


Categories: ASP.NET | Download | Microsoft | Security | Web Development

February 28, 2006
@ 01:43 PM
It's more than 1 year that I'm using URL rewriting in my web application projects to make pages adresses more friendly. Before ASP.NET 2.0 release and its URL Mapping feature, web developers had to write their own Http Handlers to perform a complete URL rewriting solution. Scott Mitchell had written a good HttpHandler for URL rewriting in ASP.NET 1.x which published on MSDN as a technical article.

For its time, this tool was good enough because it let developers use regular expression to rewrite URLs. One major problem that developers may face while using this tool is "Not Available Folders" rewrite rules. Imagine you want to rewrite a path like this: ~/News/2005/ to ~/News/Default.aspx?Year=2005. It is a good idea to let visitors hack your URLs. But if you don't have a real 2005 folder and a default.aspx file inside it, IIS will return a 404 error page. In such cases we have two solutions: 1- Make a dummy folder for such URLs. 2- Map all incoming requests to ASP.NET engine. It's clear that first solution is not suitable because you should make a new folder on the fly for a record that is added in 2006! And also the second is not a good idea because we should handle all extensions manually. As Scott said on his blog (and on MSDN article), .Text (and Community Server I guess) use a solution similar to our second option but unfortunately I didn't check them so far.

It's my story these days!! If you faced this problem too and have solutions please discuss on it in the comments. (Specially, if you have worked on .Text or CS source codes you may know more about their solutions. So as Soheil says on iDevCenter "Share Your Knowledge" !!!)


UPDATE [3/2/2006]: There is another solution for those who have access to web server. IISMods.com offers an open-source free ISAPI filter for IIS that let you perform URL Rewriting at the web server level. But this solution is not suitable for shared server hosting packages. So I won't use it!


 


Categories: ASP.NET | Web Development

February 21, 2006
@ 01:46 PM
Brian Goldfarb has collected a list of must see "How Do I" video series for ASP.NET 2.0. (Total download size: 198 MB)

 


Categories: ASP.NET | C# | Download | Microsoft | Web Development

February 21, 2006
@ 01:04 PM
MSDN Magazine Special Issue: Visual Studio 2005 Guided Tour.

Download: PDF (21.1 MB) | CHM | Code


 


Categories: ASP.NET | Download | Microsoft | Web Development | C#

February 14, 2006
@ 01:24 PM
bdasamppet401.jpgMicrosoft released PetShop 4.0. As you may know, PetShop is a web application designed to show the best practices for building enterprise, n-tier web solutions using Microsoft .NET technology. The previous version (PetShop 3.0) was a major different release because Microsoft team intoruced a model for PetShop that both SQL Server 2000 and Oracle databases were supported.

In this new version PetShop uses Microsoft .NET Framework 2.0, Microsoft SQL Server 2005 and Oracle 10g Database.

It's a few months that I am using PetShop coding and project model in my own web applications and I think that this model gives all web developers a better feel to develop their projects.

As you can read here, PetShop 4.0 is a good practice for those who want to migrate from ASP.NET 1.x to 2.0 and want to keep their coding style as modern as possible.

If you used PetShop 3.0 before and want to migrate your .NET Framework I suggest you download it right now!

Microsoft PetShop 4.0: Information | Download


 


Categories: ASP.NET | Download | Microsoft

February 6, 2006
@ 02:09 PM
Recently, using Ajax has been dramatically increased among web developers. After Google started its free email service called GMail and used Ajax in it, this technology became more popular and many developers and companies tried to build tools and frameworks for various server side technologies to be able to use Ajax benefits more easily.

From my personal view, Ajax will give your visitors a better surf and they will not bother from multiple refreshes for a single task. I have tested and used Ajax.NET Pro in my recent projects. This framework was written in C# by Michael Schwarz. I think that this framework is powerful and easy to use and implement.
Michael has a personal blog in which he writes about his open source framework. He has also created a group at Google for Ajax.NET Pro.

Two different versions of Ajax.NET Pro are available for ASP.NET 1.x and 2.0.

If you want to know more about other Ajax tools for ASP.NET take a glance at this comparison.

I'm so glad to see that many Iranian developers are using Ajax in their web sites. Even if you use Ajax in a small part of you web site it is admirable. For example quick vote and tell a friend sections at ketabeavval.ir that has been programmed by my dear friend Mohammadreza Taheri.

I have shown some simple usages of Ajax in razmpa.com. If you are an ASP.NET developer and have used Ajax in your projects please send their URLs and I will put them in an update in this post.


 


Categories: AJAX | ASP.NET

February 6, 2006
@ 12:43 PM

Today I have 2 useful free components for ASP.NET 2.0 (and one of them for 1.x as well) to introduce:
  • Code Highligher for ASP.NET 2.0 (Also compatible with .NET Framework v.1.x)
    This component is a source code syntax highlighting tool that can help you make your source codes more readable for your visitors. This component supports C#, CSS, HTML, INI files, Java, JScript, Perl, PHP, Python, SQL, VB.NET, VBScript, and XML and ... It's FREE!
    Home | Sample | Download
  • Flash Control for ASP.NET 2.0
    This component will help you add Macromedia Flash files (with .swf extension) to your web pages using a server side control. You will have full VS 2005 Designer support. The generated code validates XHTML 1.0 strict. You can download and use this control in your projects for free but also source code is available for 199 USD.
    Home | Features | Download
    [UPDATE]: Looking for a similar control for ASP.NET 1.x? Try AIxtend AI Flash'In.

 


Categories: ASP.NET | Download

February 4, 2006
@ 03:43 PM
I recently wrote a post about i18n in ASP.NET. Today while I was searching for some better articles about this issue I found Microsoft Middle East MSDN site. This web site is built to help middle eastern developers which their native language is Arabic. Since Persian language, like Arabic, is a right-to-left (RTL) language I think many articles and resources on this web site can help Persian developers build more internationalized windows and web applications. Don't miss it!

UPDATE: Dr. International blog and Microsoft Global Dev. are also interesting :D


 


Categories: ASP.NET | Microsoft | i18n

Code Project is one of my favorite web sites on the internet. I think that the level of articles and the freshness of news which are published on this web site is so much better than other web sites.
Code Project holds an online poll every week and announce its results. The questions that are asked in these polls and the answers sometimes are so funny and sometimes so usefull and technical.

This week question was "Where do you get your IT news?" and the answers:

Option Votes %
Online news sites 528 73.8
RSS feeds 219 30.6
Email newsletters 250 35.0
Podcasts 24 3.4
Webcasts 45 6.3
Blogs 181 25.3
Internet radio 12 1.7
Discussion boards 164 22.9
Responses 715

Two things are interesting to me in this result. First: RSS feeds are still in the 3rd place after Web Sites and Newsletters, and second: Blogs are in the 4th place. If you compare this situation with our country (Iran) results, I think that Blogs can be at the 1st or 2nd place but yet there is no favor in RSS Reader softwares and web sites among Iranian non-professional users.

If we deeply look at these results we find out that most Code Project users are professional web users and developers that should be interested in RSS readers and Blogs; but in real world we see another result! What do you think...?

...

These days I'm busy with a web application project which should be shipped in two Persian and English languages. In this project I decided to build a real multi-lingual web site which can be easily extended to other languages in future. I had read many articles about internationalization in ASP.NET before but never used them. On of best articles I found about i18n in ASP.NET is a 3-part article series from Code Project. You can read them here: Part 1, Part 2 and Part3.

The core concept in i18n in ASP.NET (esp. in ver. 1.x) are resource files (with .ascx extension) and satellite assemblies.

In this series of articles Karl Sequin suggested not using satellite assemblies and build a resource manager from beginning. The reason he don't like resource files and satellite assemblies is that because resource files are compiled into satellite assembiles, if you want to change a small word in translated files you should stop your web server or web site and upload new .dll files. I believe that in large scale projects he is absolutely right but in my case resource files are better choice.

If you like to know more about i18n in ASP.NET 2.0 you should take a look at Part 3 which Provider Factory Pattern are discussed.


 


Categories: ASP.NET | i18n | Web