| Generate Page URL Name for CMS, Blogs Application |
| For any CMS, Blog application dynamic page creation is one of the way to create pages. |
| Posted Date: 06 Feb 2008 |
|
| Author : Pritam Baldota |
|
Description
Hi All,
To give the Name to the Page can be handeled by many ways like
- Using GUID (Issue- Cant identify exactly while browsing through pages)
- Using Session (Issue-Same as above)
- Using Page Title provided in Text Field (We will see this)
We are going to implement the scenario 3. We will first see what are our constraints for page url name.
- It should be only Alphanumeric enabled like - About-Us.aspx
- No other character should include in the page name like - %,@,$ etc
Its just about Regular Expression to identify the alphanumeric characters. The reqular expression is in System.Text.RegularExpressions namespace.Â
Regex.Replace(strInput, "[^\\w]", "");
If you give the page Title to - About % US #$ output will be AboutUs.aspx
Happy Coding :)