Hi nauna,
Refer below code.
C#
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(createurlpath("*Nikon camera.&?/:"));
}
public string createurlpath(string value)
{
string returnpath = System.Text.RegularExpressions.Regex.Replace(value, @"(\s+|\.|\,|\:|\*|&|\?|\/)", "-");
return returnpath;
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Response.Write(createurlpath("*Nikon camera.&?/:"))
End Sub
Public Function createurlpath(ByVal value As String) As String
Dim returnpath As String = System.Text.RegularExpressions.Regex.Replace(value, "(\s+|\.|\,|\:|\*|&|\?|\/)", "-")
Return returnpath
End Function
Output
-Nikon-camera-----