ASP.NET Website Administrator Tool in VS 2013 - asp.net

Is there a short cut method to open website administrator in visual studio 2013, other than the method specified below
http://blogs.msdn.com/b/webdev/archive/2013/08/19/asp-net-web-configuration-tool-missing-in-visual-studio-2013.aspx

By Windows Explorer, copy folder ASP.NETWebAdminFiles and all its content to your solution folder (root folder of your WebApplications).
ASP.NETWebAdminFiles exists in %systemroot%\Microsoft.NET\Framework\v4.0.30319\
%systemroot% usually refers to C:\Windows
On VS2013+ \ Solution Explorer Window, do right click on your solution name; go over Add, on expanded menu click on Existing Web Site... item.
On opened dialog, on left pane choose File System, on right pane browse to your solution folder and select ASP.NETWebAdminFiles then click on Open button.
In added web site, in folder App_Code, find and open WebAdminPage.cs then:
4.1. find class WebAdminPage , find method OpenWebConfiguration that has 3 parameters, replace last line of code with this:
return WebConfigurationManager.OpenMappedWebConfiguration(fileMap, path, "localhost");
you can use domain name or IP Address instead of localhost
4.2. find class WebAdminModule, find method SetSessionVariables, find first if block:
if (application.Context.Request != null) { ... }
inside if block, replace two lines of codes with these:
queryStringAppPath = "/";
queryStringApplicationPhysicalPath = #"D:\PHYSICAL\PATH\OF\YOUR\MAIN\WEB\APPLICATION\";
4.3. Make sure provided physical path ends with a BACKSLASH.
4.4. [NEW] if you going to run this tool on localhost, in class WebAdminModule, find method OnEnter then find first if block:
if (!application.Context.Request.IsLocal) {...}
make whole of block as commented text:
//if (!application.Context.Request.IsLocal) {...}
4.5. On VS2013+ \ Solution Explorer Window, click on ASP.NETWebAdminFiles, on Properties Window set Windows Authentication as Enabled then set Anonymous Authentication as Disabled.
4.6. Set ASP.NETWebAdminFiles website as StartUp Project then run it.
It works, I use it for my applications over Intranet and web.
Good luck.

After a long wait, here is the replacement for the ASP.NET Website Administrator Tool:
Thinktecture.IdentityManager as a replacement for the ASP.NET WebSite Administration tool
Since then, ASP.NET has introduced ASP.NET Identity and community member Brock Allen created IdentityReboot with some significant improvements and extensions. Brock Allen and Dominick Baier have gone even further and created Thinktecture IdentityManager. It's the beginnings of a nice bootstrapped replacement for the missing ASP.NET Website Administration Tool. It is nicely factored and supports both ASP.NET Identity and their alternative called MembershipReboot.
Hope this helps.

Related

How do you allow parent paths in Visual Studio 2015?

I've opened an existing web application project from Visual Studio 2013 (which runs just fine), in Visual Studio 2015. When I run it from within Visual Studio 2015 I get:
Active Server Pages error 'ASP 0131'
Disallowed Parent Path
/blah/login.asp, line 1
The Include file '../includes/Security.asp' cannot contain '..' to indicate the parent directory.
My IISExpress applicationhost.config file already contains the entry:
<asp appAllowClientDebug="false" appAllowDebugging="false" errorsToNTLog="false" enableParentPaths="true" scriptErrorSentToBrowser="true" bufferingOn="true">
<session allowSessionState="true" />
<cache diskTemplateCacheDirectory="%SystemDrive%\inetpub\temp\ASP Compiled Templates" />
<limits maxRequestEntityAllowed="1073741824" />
</asp>
My web application properties are set to use IISExpress.
What could I be missing?
The 'applicationhost.config' has moved and is now located in the hidden .vs folder. Make sure you're updating the right file.
Here is a much clear explaination although the accepted answer is in the right direction.
Since VS2015, IIS Express has changed where it picks up your applicationHost.config file. This is presumably to simplify the distribution of projects. It has moved away from the traditional C:\Users\<profile>\Documents\IISExpress\config\applicationhost.config folder (although this file will still exist on your computer to support older VS installations).
It is now located in the application project's root folder as a hidden file. To save you hunting for it, here is how you open it quickly and easily:
Right click IIS Express from the tray icon and select Show All Applications.
Click on the URL entry of your application. The "Path" and "Config" values then are shown as hypertext links further down in the IIS Express window.
Click on the Config hypertext to open on your preferred editor. (e.g. C:\<Path-To-Project>\.vs\config\applicationhost.config)
Hope this helps.
I wanted to add my version of a very similar answer because I still had to do some searching to get the expected end results. Although the original question just really wanted to know why the current config that was being used was not working and it was in fact explained in the accepted answer, it did not help someone like me coming into the question. I needed to know everything to do in order to achieve allowing parent paths when debugging. So here is my answer in detail...
How to configure the IIS debug server in Visual Studio 2015 to allow parent paths:
First you need to find the IIS Express tray icon.
Next you need to open the IIS config currently running for debugging by right clicking on that tray icon. You will then see the following context menu. You will need to click on "Show All Applications".
This will then show you the configurations of the IIS debug server you are running. There will also be the project you are working on listed in this list.
Click the projects name (in this case "Web") under the Site Name column. You will then see the Path of the project and the Config file being use to run the debug IIS server. You will then click on the Config path to open the applicationhost.config in your default text editor.
This will open up the config file you are using when debugging your project. You will need to scroll down until you find the <system.webServer> section. Then look for the <asp> section. In my case it was <asp scriptErrorSentToBrowser="true">.
Then you just need to edit the asp section to include enableParentPaths="True" as shown in the image below.
The just save the file and restart the debugging process. Note: I only had to hit F5 in the IE browser to see the change. I did not have to close the browser and restart the debug process over again.

Confused with IIS locaton of the virtual directory

I have IIS 7.5 and when I go to InetMgr, I right-click on the default website and then choose Explore. I see:
C:\inetpub\wwwroot
So far so good and as expected.
Now I created a C# web application and created a virtual directory under the default website. I right-click and explore I see :
C:\CSharpTest\WebApplication8\WebApplication8
This is also can be expected. However, when I run the Application, pictures are not loaded since the WebApplication8 folder is not created in C:\inetpub\wwwroot.
I know .NET 2.0 VS 2005 does create the folder in inetpub\wwwroot. So under VS 2010 do I need to copy files manually to the Inetpub/wwwroot?
When the page loads I see an empty picture place holder. If I right-click on it and then choose properties I see:
http://aocalhost.com/WebApplication8/pics/a.jpg
Then If I put this directly into the IE:
http://alocalhost.com/WebApplication8/pics/a.jpg
I get an empty page.
Just found the answer after spending 5 hours googling.
I tried almost a dozen of solutions but what worked for me was to enable static contents for the IIS.(Use Add/Remove Software in control panel/windows features)

How do I prevent IISExpress & My Web Sites folders from cluttering up my My Documents folder?

I noticed recently IISExpress & My Web Sites folders are getting added to the My Documents folder on my Windows 7 machine. I recently installed VS2012, so I'm guessing that's the culprit, but I haven't been able to find anything on line that explains how to change these defaults, if possible.
Microsoft cluttering up my 'Documents' folder with all their programs' (junk) folders drives me insane as well. I have conceded somewhat by creating a Data folder under my Documents folder, where I am pointing all MS apps (and others apps such as Firefox's profile folder) to for all their (generally unwanted) folders, and with a subfolder created for each program/suite. At least this way I can easily back up all settings when I back up my 'Documents' folders.
Anyway, VS2012 installs IIS Express, which is what is causing these folders to be created. I have found two solutions for dealing with the unwanted folders.
Uninstall IIS Express. You can do this from the normal Windows 'Uninstall a Program' part of Control Panel.
Change the folder location that IIS Express uses, as follows. Be warned: anyone doing this risks causing problems with their computer if you don't know what you are doing, so you do so at your own risk. Please make appropriate backups along the way as well too!
a) Close Visual Studio.
b) Create a new folder for the IIS Express sub-folders:
eg. D:\My Documents\Data\Microsoft\IISExpress
c) Move the existing unwanted IISExpress subfolders (config, Logs, TraceLogFiles) from your My Documents > IISExpress folder to the folder created in step b).
d) Create a new folder for the My Web Sites folder, I suggest also under the folder created in step b).
eg. D:\My Documents\Data\Microsoft\IISExpress\Websites
Under this folder, create a website for the default IIS Express website (in case it "auto-magically" reappears it's ugly head again later on).
eg. D:\My Documents\Data\Microsoft\IISExpress\Websites\Default
e) Go to the newly located config folder at:
eg. D:\My Documents\Data\Microsoft\IISExpress\config, and:
i. Open the file applicationhost.config in your text editor (eg. Notepad).
ii. Find the node sites > site > application path > virtualDirectory path for WebSite1, and change the physicalPath value from %IIS_SITES_HOME%\WebSite1 to the IIS Express default website folder you created in step d).
Eg. %IIS_SITES_HOME%\Websites\Default.
Note that %IIS_SITES_HOME% points to your 'Documents' folder (this appears to be a "feature" of IIS Express, I can't find a way to change it, and it appears to be auto-configured when IIS Express starts up, which it does by using the applicationhost.config file).
Do the same for any other sites created by IIS Express.
f) Create a new registry entry pointing IIS Express to the new folders you created (partly explained by MS here: http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-80-express-readme). FYI the registry key doesn't previously exist, as IIS Express uses a default of my Documents unless this key exists:
i. Open the Windows 'Run' box, eg. (Windows Key) + R
ii. Type regedit
iii. Navigate to key: HKEY_CURRENT_USER\Software\Microsoft
iv. *Right click* the Microsoft key (that you have just navigated to), and choose: New > Key
v. Type IISExpress
vi. *Right click* the IISExpress key that you have just created, and choose: New > String Value
vii. Type CustomUserHome, and hit the Enter key to save it.
viii. Double-click the CustomUserHome string to enter a value for it, and for the Value Data: field, type in the path to the new IIS Express folder you created in step b), for example: D:\My Documents\Data\Microsoft\IISExpress. Press OK, and you can now close the Registry Editor.
g) Reopen Visual Studio, and it should start using the new folders, as well as not create the folders in your Documents folder anymore. Yay!!!!!
FYI, when I did this all, I actually did it in a slightly different order (creating the registry key first), but this order was the easiest way to explain it all. Whether you create the key first or last shouldn't matter, as long as you do all the steps. Good luck!
A Tricky solution
Make a copy of your C:\Users\<user>\Documents\IISExpress folder
first
Create a symbolic folder called IISExpress inside the C:\Users\<user>\Documents folder using the following command
mklink /J C:\Users\<user>\Documents\IISExpress D:\IISExpress
Move all the content from your copied IISExpress into D:\IISExpress
Thats all
If you're just looking to declutter your Documents folder, one simple workaround is to set the unwanted folders to hidden so it's no longer visible.
You can do this by right clicking on the IISExpress folder > Properties and checking the hidden property at the bottom. The folder will still remain in your Documents folder but won't be visible to you. If for some reason you want to access these folders again, you can toggle hidden item visibility in File Explorer's View tab.

How to add the Project root to the localhost path

My asp.net project, currently runs from http://localhost:51143/default.aspx
Is there anyway, I could include the root to this like http://localhost:51143/TOrders/default.aspx The reason I want to do this is because the URls that get called on the menu click events refer to "TOrders/Reports/aaa.aspx and so on and in production it would refer to intranet/TOrders/Reports/aaa.aspx and so on.
One solution could be to intercept every request in Application_BeginRequest method in Global.asax.
There you can create a rule to remove TOrders/ from the beginning. Try something like this:
void Application_BeginRequest(object sender, EventArgs e)
{
if (Request.RawUrl.StartsWith("TOrders/"))
Server.Transfer(Request.RawUrl.Substring(8));
}
This may not the nicest solution, but it should be enough to give you idea what to do.
Edit:
Since you have web project (not a web site), you can set virtual path of your project. I think this is what you are looking for.
If you are using VS2010, in Solution explorer right click on your project and chose Properties, then on Web tab, in Servers section, change virtual path of your project to /TOrders/ instead of / which is default value. Now you should get http://localhost:51143/TOrders/default.aspx
You need HttpRequest.ApplicationPath property
or HostingEnvironment.ApplicationVirtualPath property.
Also useful for building virtual paths is VirtualPathUtility class.
EDIT:
Try to copy your project into a subfolder of you web root, for eg. in IIS:
C:\inetpub\wwwroot\ (or what you set)
C:\inetpub\wwwroot\MyProject\
Now in IIS Managment Console, in your Default Web, you create a new 'Application'. Either you upgrade the existing folder or you create a virtual new one to your folder.
Then select a virtual path (TOrders) and set the physical path. There you will also set the AppPool if you have .NET 4, or select the runtime if you have 2.0/3.5 on IIS6.x. Try the highest version first...
Go to localhost/TOrders/

Rename the Project in VS 2008 from C#

VS 2008 : ASP.Net
My Project Solution file name is abc ..
So, when i run the application - it shows http://localhost/abc/login.aspx
But i need to rename the project as ..http://localhost/Reports/login.aspx
Without changing the folder / solution file or creating a new project .. is there any way for me to set it in the config file for changing the project name !!
You can set the start page in your web project Properties -> Web tab. There you can choose "Specific Page" as the Start Action and type for example "Reports/login.aspx" there.
Whether this URL will be served by your application correctly is another issue (if you use MVC routing mechanism, and I guess you do if you tagged the question with asp.net-mvc, you may have to check if one of your routes handles this particular URL).

Resources