Code to get *.aspx in a website - asp.net

Is there a method to get all of the .aspx files in my website? Maybe iterate through the site's file structure and add to an array?

Directory.GetFiles(HttpContext.Current.Server.MapPath(#"/"), "*.aspx", SearchOption.AllDirectories);

using Directory.GetFiles("*.aspx"), you can get all the files in the directory. And you can make it recursive to grab any sub directories and their files.

Keep in mind that you can define an .aspx page without having an actual file be there in the web.config.

Related

How can I create directly my own rss.xml in OctoberCMS?

I want to generate rss.xml file in OctoberCMS by manually. Other plugins cannot be customized what I want. How can generate it by my own hand? Any suggestion?
You could use the File::put method to place an XML file within the theme assets public folder.
File::put(themes_path('mytheme/assets/somefile.xml'), $xmlContents);

RazorGenerator not generating the correct namespace

We're using RazorGenerator for our project. When I edit views, the generated files' namespaces are changed to ASP instead of the RazorGenerator's default, which is supposed to be the folder structure. We didn't change any settings for RazorGenerator (not even sure if there are settings) so I'm not really sure what happened since this happens to my machine only. I already uninstalled/installed the tool but the same thing happens. Anybody have a solution for this? Thanks!
Hey i just had the same issue. According to this http://razorgenerator.codeplex.com/workitem/166 you should create a file in your views folder called razorgenerator.directives and add in it the following:
GeneratePrettyNames: true
and it will generate the correct namespace.

How do i change the index.html flex output to admin.anotherExtension?

i need to change the automatically generated index.html flex output to admin.anotherExtension. I understand that if i change the index.template.html the changes in html level will be preserve when the file is generated, however i need to change the name of the file also, and the extension.
Thank you! (using flashBuilder4)
In the html-template directory. Create a new template file named something like this:
${application}${build_suffix}.template.cfm
The next time you build your project, you'll get a file with the extension .cfm that is the same name as your application. You can use whatever extension of your choosing. My source
If you create your own file in the html-template directory (say: index.cfm ), I'm pretty sure that file will be copied to your build directory, but not changed.
Keep in mind all your changes will be overwritten if you change the Flex SDK on the project. Back them up somewhere.

Getting a directory's path, that is inside an assembly

I have a custom asp.net control. That control will also render to the page a piece of javascript. This javascript piece of code is actually properties that have to be initialized. One of this property value must be a path. This path is a directory that is inside this assembly. If it is was a file i would use GetWebResourceUrl but now I don't know what commands to use.
Also I would like to know, if I get the dir path the files inside it will be available for the javascript to use them or not?
Try this: System.Reflection.Assembly.GetExecutingAssembly().Location

Is it possible to upload entire folders in ASP.NET?

The file upload control in asp.net does not allow me to select a folder and enables me to select only the files. Is there any way in which I can select a folder (obviously without using the file upload control).
Why I want to select the folder is basically to store its entire path in a database table.
The HTML <input type=file> element only supports single file uploads. If you to have multiple file upload, you would have to use a 3rd party component - usually written in Flash.
Here an example: http://www.codeproject.com/KB/aspnet/FlashUpload.aspx
No, browsing for files are the client-side feature, and the only information about file path is their name. It's cause security.
I dont think HTML supports what you are trying to do. Perhaps as a workaround you can have them select a file in the folder and then chop off the file name when processing it but thats a mess to be honest.
Ask them to Paste or type the path into a textbox perhaps. The issue here is you cant check for typos.
Id say you should rethink what you are trying to do.

Resources