Search code examples
c#visual-studiopathfilenames

C# File Name Formatted Like a Web Address


I've got a file name that I am unable to change. This is an example of what the file name looks like "www.Test.somee.com"

If I try and path to this file name in Visual Studio it will error because of all the full stops.

What's a way of making C# recognize this is a file name and not code?

This is the line I'm using it for.

public partial class www.Test.somee.com_Website_Default : System.Web.UI.Page

I recieve all these errors for that one line.

Error   2   Invalid token '.' in class, struct, or interface member declaration     
Error   3   Invalid token ':' in class, struct, or interface member declaration     
Error   5   The namespace '<global namespace>' already contains a 
definition for 'www'    

Solution

  • You can't have a page that has such name, because it's invalid. (that's what those errors mean)

    If you want such ugly names, you'd have to substitute . for a different character, for instance _ or -.

    Please see general guidelines for naming your classes.

    http://msdn.microsoft.com/en-us/library/ms229040%28v=vs.110%29.aspx