MVC3 start page - visual-studio-2010

I am working on a web app in Visual Studio 2010, its mvc3. I Was trying to figure out how to publish it, and through various instructions I tried setting View/Home/Index as the start page. This was a bad idea. Now nothing is working, even trying to view the site as I have been (debugging with F5) is not loading properly.
I don't know what the start page was before, or how to undo this. I am very new to web development, and a little lost right now. How do I get my start page back?

Go to the project's Properties
Go to the Web tab
Select the Specific Page radio button
Remove url in the Specific Page text box
Save Properties Tab.

Try setting the start page to /.

If you leave it alone after set up, it should be like so:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
My suggestion is leave it like that. How do you "get back"?
Simple: Open another instance of Visual Studio. Create a blank MVC3 project. Copy over the routing rules and add custom rules (if any) below. Copy over the web.config with any customizations you have made (if any).
Then, right click the project and select publish. If you publish to a local folder, you will have to set up IIS properly, but you can work through the kinks on your local IIS instance (assume you have installed it, as this is a developer machine?). Once you know the set up, you can move to the server and you should be fine.
That is about all of the time I have for this one right now. Good luck!

i know this is an old post... but whoever comes after this would find the piece of info helpful
if you want to change the start up page in MVC3 u can do so by just specifying like this
Specify Page: Account/Logon
No need to include the view name if you say Views/Account/LogOn it would return Resource not found error and if you include / it would say bad request.
I tried the above option and could change my start up page from the annoying index page to LogOn.cshtml

Simply change your starting url to /Home/Index or / (or remove it) - you cannot address items directly in the /Views folder.

Try creating a new html file in the main project and set it as the default. Then delete the file. That should remove the start page. You do not need one for Mvc.

Right click on project --> Properties
Go to the Web tab
Select the Specific Page radio button
Specify the start page as ControllerName/ActionName as it comes in the browser url when the page is loaded
Save.

Related

Umbraco adds extra slash to beginning of page URL

Umbraco 7.12.4
Recently I renamed a node in Umbraco. It used to be called "Projects". I want it to be called "My Projects". After renaming it, no matter whether I put the name back to the original value or set an entirely new value, the following occurs:
Change page name
Click on properties. The Url appears correct, without an extra /
Access the website. The website works correctly
Access the website AGAIN. This page now redirects to http://my-projects and fails.
Click on properties. The Url now appears as in the image below.
I have checked routes. Cleared URL redirects. Emptied recycle bin. Tried page names that have never existed before.
Any ideas? I am pulling my hair out. Thanks!
The problem was related to a missing host name - look at comments :-)

Joomla External Link -

I am using the external link type menu items within Joomla - the reason is I need to link direct to an anchor on another page from the menu.
I have around 10-15 links, all work as expected except 2.
in my external URL box I have something like this:
"index.php?option=com_content&view=article&id=10&Itemid=207#SystemIntegration"
id - is the article id
Itemid - is the menu item I want to be active
hashtag - is my anchor link
PROBLEM:
On the 2 that are not working it seems to go to url with this "http://www.website.com/component/content/?Itemid=207#SystemIntegration" instead of "http://www.website.com/services/digital-solutions/SystemIntegration#SystemIntegration" as expected
has anyone else had this issue? I have a feeling its connected to the SEF urls being on.
Joomla 3.5.0 version
Step1. Create a Hidden Menu from Joomla admin==>Menus==>Manage==>add
new menu
Step2. Select a Hidden Menu ==> add a new menu item==>Menu Item
Type==>Article==>single article==>your article id==>save
Step3. Site load this url(take copy)
Step4. Create a new menu from external url Pate the previous url
(include #)
Nothing I tried worked reliably - so I got round it by making each item go to the single article, then using a spare field to store the name of anchor. Then within some custom JS code I checked if the field was set and automatically scrolled the page to it if it was - works better than the joomla standard anyway and is more reliable

how can i get my login page in area?

I have 2 areas in my project: Admins , Members
and I have Login.csthml in view folder.
Therefor,its Address is:
http:localhost.com:5555/Areas/Members/view/Login.cshtml
I want to create the text link "login" at home page of my site ,
when i click on it, it should go to login page that i said above.
i use this code:
#Html.Action("Login", "Members")
but , it doesnt know it should go to Members Area, and it throws an error:
{"The view 'Login' or its master was not found or no view engine
supports the searched locations. The following locations were
searched:\r\n~/Views/Members/Login.aspx\r\n~/Views/Members/Login.ascx\r\n~/Views/Shared/Login.aspx\r\n~/Views/Shared/Login.ascx\r\n~/Views/Members/Login.cshtml\r\n~/Views/Members/Login.vbhtml\r\n~/Views/Shared/Login.cshtml\r\n~/Views/Shared/Login.vbhtml"}
what should i do?
Do you have the area registeration on the Global.asax? When adding an area by right-clicking on the project and using the wizard all the coding for that is done automatically.
Also the address you posted is not correct... it should be something like http: localhost:[port]/[AreaName]/Members/Login
try using this url form to see if the routing is working or not

Loading an MVC site

Hello I am in desperate need of help. I just created an MVC site made in Visual Web Developer 2010
and each time and on different Web Hosts I get --Index of /-- instead of the site loading properly. It's as if the server or browser is looking for an 'index' file instead of being routed through the MVC folders to the proper start up page. I've done everything I believe I am suppose to do as far bring all my dll 'system' files to the 'bin' folder as well as everything else including getting a Web Host that has MVC supporting server but I still keep getting 'Index of /' and the folders instead of the site. Can anyone help? I'm really in a spot. I've been working on this site for months and I need to get it up and running.
Thanks, Rob
It looks like your default route is not setup or the setup is pointed to a place that doesn't exist. Your default route will be in the default.asax.cs page (MVC4 is App_Start/RouteConfig.cs) and looks something like this:
routes.MapRoute(
"Default", // Route name
"", // URL with parameters
new { controller = "Home", action = "Index"} // Parameter defaults
);
So the the Default action is Home/Index. You can change this if you want to redirect to a different default page.

MVC3 - How do I route to a subsite?

I have a subsite within my main site for site Administration. The site is physically stored in the form
~/Views/Administration/ViewName/Index
With controllers inside
~/Controllers/Admin/ControllerName
I am getting an exception trying to visit the page.
The view 'index' or its master was not found or no view engine
supports the searched locations. The following locations were
searched: ~/Views/ViewName/index.aspx ~/Views/ViewName/index.ascx
~/Views/Shared/index.aspx ~/Views/Shared/index.ascx
~/Views/ViewName/index.cshtml ~/Views/ViewName/index.vbhtml
~/Views/Shared/index.cshtml ~/Views/Shared/index.vbhtml
I added a route
routes.MapRoute(
"Administration", // Route name
"Administration/{controller}/{action}/{id}", // URL with parameters
new { controller = "Administration", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
Going directly to the page manually
http://localhost:999/Administration/BaseItem/index
Does not result in exception, but I get no content. This leads me to believe it is not finding the View. What am I doing wrong?
I think the issue is that I have told the route engine how to route to the Controller, but I have not told the system how to route to the View. Where do I tell the system where the views are?
The problem is not with the routes, but with the design. The view engine cannot find your view, because it cannot find the correct path, since the default view engines are not designed to search for a subsite.
Instead of creating a subsite, make Administration an Area in your project. In AdministrationAreaRegistration.cs, you will set a route similar to the route you added. Place your views in the Views folder inside the Administration folder (inside the Area folder), and everything will work properly.

Resources