Deploy web app to Azure but still showing Microsoft page instead of the webform created

I am attempting to publish a web app (mvc project) from visual studio to azure but I keep getting the blow page Deploy web app to Azure but still showing Microsoft page instead of the webform created

I am not sure what to do. I’ve added WebForm2.aspx in the default document (on azure) and added the below tag in the web.config page but still no luck
Deploy web app to Azure but still showing Microsoft page instead of the webform created

Any ideas please?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You can just use a Response.Redirect from your WebForms code with the right URL which gets routed to your controller in question, I guess in your case, that is:

Response.Redirect("/Home/Index");

Or even better you could make an extension method for HtmlHelper that handles your routing:

public static class ExtensionMethods
    {
        public static MvcHtmlString WebFormActionLink(this HtmlHelper htmlHelper, string linkText, string ruoteName, object routeValues)
        {
            var helper = new UrlHelper(htmlHelper.ViewContext.RequestContext);

            var anchor = new TagBuilder("a");
            anchor.Attributes["href"] = helper.RouteUrl(routeName, routeValues);
            anchor.SetInnerText(linkText);
            return MvcHtmlString.Create(anchor.ToString());
        }
    }

Your Routes:

public static void RegisterRoutes(RouteCollection routes)
{

    routes.MapPageRoute(
          "Webforms-Route", // Route name
          // put your webforms routing here
         );

        routes.MapRoute(
            "MVC-Route", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } 
            );
    }

You would then just pass in your route to your HtmlHelper and you will get the correct route.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x