Rename the Project in VS 2008 from C# - asp.net

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).

Related

ASP domain and files

I have no idea about asp, but I had to do some modifications in a web site, an easy modification. So I downloaded all files from server and I did all the modifications in Visual Studio 2013. Then I tested each page in the local host and it was perfect.
When I uploaded the files, I created a folder called "development", to tested it before I changed in the real site, so, my real site is for example "www.realsite.com" and my new folder is inside, with all the file, so I write in my url "www.realsite.com/development" and it shows the page, but not the one I had modified, but the real site. I want to know if there is a config file to change the path of the development site to see the changes I make and not the real site, because if I click in the development site a menu, it sends me to the page in the real site.
I hope you can help me with this,
Thank you!
PS: Do you know what is the meaning of "~/" in for example : src="~/folder/folder/xxxx.xx"
This is because the URLs in the project are using absolute paths, all pointing to the root. If they were using relative paths, moving the project to a folder and running it from there would work just file.
The difference:
... <-- absolute, note the leading slash
... <-- relative, no leading slash
Well, it depends on what kind of changes you are referring to, what kind of ASP.net site (or application).
The ~/ in ASP.Net means "path from application root". A subfolder (the new folder you created) in an existing application is just that, a folder. It is not "another application root". So if the existing code refers to "its root", e.g. where it uses ~/, it's probably not what you would expect..
Again, not enough info, but if you experience more unexpected behavior, it will probably be because of this (application scope).
Ref: ASP.NET Web Project Paths
ASP.NET includes the Web application root operator (~), which you can use when specifying a path in server controls. ASP.NET resolves the ~ operator to the root of the current application.
Hth...

ASP.NET Website Administrator Tool in VS 2013

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.

ASP.NET MVC 4 IncludeDirectory from a another referenced project

I'm facing out a strange problem while using ASP.NET MVC 4.
I have 2 "Web Site" projects:
The first named "MyWebSite"
The second named "MyWebSite.Support"
I need to include the scripts under MyWebSite into MyWebSite.Support, so i thought to create a bundle in MyWebSite.Support and to reference that directory (MyWebSite/Scripts) inside that bundle by using "IncludeDirectory"
The problem is that i didn't found a way to correctly do that. It simply doesn't work because the starting path for the IncludeDirectory should be "~", which is the project virtual root path.
PS: If you have another solutions they are welcome!.
I don't even know if it's a good solution (i usually am not a everything_related_microsoft developer)
You could add the scripts as a link to the other project. This will assure you that they are copied when you deploy and you can use them in bundles. To do that, right-click on your scripts folder and select "Add existing item". In the dialog box select the files you want to add. Instead of clicking "Add Item", click on the little arrow next to it and select "Add as a link".
This will not actually copy the files, but include them as a linked file.
This has several advantages:
Files are shared between projects at Design time
You only need to share the files you want, not everything
You don't need any IIS configuration
You can easily edit the same file from each project (without copying it)

How to create a solution file using vs 2008

I have all the files for the deployment listed below :
-BIN
-CSS
-IMAGES
default.aspx
PrecompiledApp.xml
Web.xml
The above files can be copy pasted in the webapps folder and default.aspx could be run from the browser.
i want to create a solution sln file from this. How to create a solution file?
A solution is merely a container of projects. If you create a project containing these files, the solution file will be created automatically in the same directory (unless you specify otherwise).
File -> New Project
Expand Other Project Types, Select
Visual Studio Solutions
Under Templates, ensure you have
selected Blank Solution
Enter a name and a location for the
solution and click OK
File -> Add -> Existing Web Site
Select the folder that contains your
website and click Open
It looks as though you are creating a web site. I've never been able to create a solution with just a website in it (a web application is a different beast however). However, I have found a workaround, although it's a little cludgy. Create a new class library project (any project type will do really). This will create the project file. Then File -> Add -> Exisiting Web Site. Point to your existing web site and add it. This will create the solution file as you now have two items. You can now delete the first project that you created. This will leave you with a solution file with one web site in it.

Referencing code in VB.NET

I'm not at all familiar with VB.NET or ASP. I need to create a simple page which makes a call to a remote web service. I used the wsdl utility which comes with the DotNet SDK to generate a service proxy and write it to a VB file. Unfortunately I have no idea how to reference this code in either my ASPX file or the code behind VB file so I can create an instance of the proxy.
Edit: I should have qualified this by noting that I'm not using visual studio. I just coded up a .aspx with a .vb behind it and dropped it into an IIS location. Is there a way to do what you're suggesting outside of VS?
You need to add this code into your project so that it can be consumed.
Right click on your App_Code folder and select "Add Existing Item". This will bring up explorer. Use it to select the generated file and it will add it to your project.
Now you will be able to reference this code from within your page or code behind file
If there isn't an App_Code folder in your project, then right click on the project in solution explorer and select "Add New ASP.Net Folder"->App_Code
Or, instead of the wsdl utility:
In the solution explorer windows, r-click on the project, and select "add web reference". In the dialog that comes up, put in the url to the web service. In the web reference name box (lower right of that dialog), put in whatever you want to local alias for the service to be called.
So, if you put in a url of:
http://otherserver.com/otherservice.asmx
And, a web reference name of:
xyz
To use it, your code would look like:
dim x as new xyz
var = x.methodname()

Resources