Generate Page URL Name for CMS, Blogs Application
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 🙂