My question is about Asp.Net website hosting on shared server. I have a website which has 1 master page and 4000 child pages, website is made in asp.net but pages are like static - I am not using any database in it. I simple create a child page from the master page, write the Title, Heading, Description & content. Website has 30,000 to 40,000 pageviews per day.
The issue is that: When I make any change in the master page, website went down for 3-4 hours. No issue with child page uploading - to upload the pages I use FileZilla(any number of child page can be uploaded and no Issue of website down).
I am using GoDaddy's Ultimate Windows Hosting plan
Here is my Master page code:
<%# Master Language="VB" AutoEventWireup="true" CodeFile="mpageR.master.vb" Inherits="mywebsite" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="css/W3.css"/>
<link rel="stylesheet" href="css/style1.css"/>
<!-- START: Analytics-->
<!-- Analytics code-->
<script type="text/javascript">
...
</script>
<!-- END: Analytics Code-->
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<!--Main Page Section-->
<form id="form1" runat="server">
<div class="w3-row">
<!--Header control (reading a file in this control to show header section)-->
<%# Register TagPrefix="uc" TagName="header_cntrl" Src="~/user-controls/header.ascx" %>
<uc:header_cntrl id="header_cntrl1" runat="server"/>
<!--End of Header-->
</div>
<div class="w3-row">
<!--main section-->
<div class="left-panel">
<!-- Left Nav Menu (reading file for left panel)-->
<%# Register TagPrefix="uc" TagName="LeftNavMenu" Src="~/plugins/LeftNavMenu.ascx" %>
<uc:LeftNavMenu id="LeftNavMenu" runat="server"/>
<!-- End of Left Nav Menu-->
</div>
<div class="main-panel">
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<div class="right-panel">
<!-- Right Nav Menu (reading file for right section)-->
<%# Register TagPrefix="uc" TagName="RgtNavMenu" Src="~/plugins/RgtNavMenu.ascx" %>
<uc:RgtNavMenu id="RgtNavMenu" runat="server"/>
<!-- End of Right Nav Menu-->
</div>
</div>
<br />
<!--Footer control (reading file for footer)-->
<%# Register TagPrefix="uc" TagName="footer_cntrl" Src="~/user-controls/footer.ascx" %>
<uc:footer_cntrl id="footer_master" runat="server"/>
<!--End of Footer-->
</form>
<!--End of Main Page Section-->
</body>
</html>
Web.config file:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
</compilation>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
<customErrors mode="On">
<error redirect="~/error.aspx" statusCode="404"/>
</customErrors>
</system.web>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^mywebsiye.com$" />
</conditions>
<action type="Redirect" url="https://www.mywebsite.com/{R:0}"
redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Related
I have added following configurations, but it wont apply the css and js. Is there anythy i need to add other than these
Config.xml
<mvc:resources mapping="/resources/**" location="/resources/" />
jspfile
<%# taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<spring:url value="/resources/css/metro.css" var="metro" />
<spring:url value="/resources/css/metro-schemes.css" var="metroschemes" />
<spring:url value="/resources/css/metro-icons.css" var="metroicons" />
<link href="${metro}" rel="stylesheet">
<link href="${metroschemes}" rel="stylesheet">
<link href="${metroicons}" rel="stylesheet">
<script src="${jquery}"></script>
When I go to the root of my ASP.NET website, the request goes into the ASP.NET pipeline and then returns index.html.
Is there a way in web.config to configure this so that IIS simply returns the file without going into the ASP.NET pipeline?
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
</head>
<body>
<h1>Test</h1>
</body>
</html>
Global.asax:
using System.Web;
namespace Test
{
public class Global : HttpApplication
{
protected void Application_BeginRequest()
{
var url = this.Request.Url;
}
}
}
web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
You can set runAllManagedModulesForAllRequests=false inside web.config. It has other side effects, but can give a try first.
<system.webServer>
<modules runAllManagedModulesForAllRequests="false" />
</system.webServer>
I've put together a very basic tutorial for a jQuery Mobile app with a very basic tutorial using the Web Api with VS 2013 and VB.NET. The Web Api is just for use with my UI within my app as a way to bridge between html and asp.net. It works perfectly on my development machine but the Web Api part fails when I move it to my hosting service (WinHost). I assume that there is a web.config entry that will fix this - but, I'm totally lost on this point. The html/jQuery code is:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/custom.css" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.3.2/jquery.mobile.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<title>Boilerplate</title>
<script>
var uri = 'api/class1s';
function formatItem(item) {
return item.field1;
}
function find() {
var id = $('#prodId').val();
$.getJSON(uri + '/' + id)
.done(function (data) {
$('#product').text(formatItem(data));
})
.fail(function (jqXHR, textStatus, err) {
$('#product').text('Error: ' + err);
});
}
</script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Boilerplate</h1>
</div>
<div data-role="content">
<p>Page Body content</p>
<div>
<input type="text" id="prodId" size="5" />
<input type="button" value="Search" onclick="find();" />
<p id="product" />
</div>
</div>
<div data-role="footer">
<h4>Footer content</h4>
</div>
View Full Site
</div>
</body>
</html>
The web.config is:
<configuration>
<appSettings></appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
</system.web>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
</configuration>
There is also a WebApiConfig:
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web.Http
Public Module WebApiConfig
Public Sub Register(ByVal config As HttpConfiguration)
' Web API configuration and services
' Web API routes
config.MapHttpAttributeRoutes()
config.Routes.MapHttpRoute(
name:="DefaultApi",
routeTemplate:="api/{controller}/{id}",
defaults:=New With {.id = RouteParameter.Optional}
)
End Sub
End Module
There is also a class to define the data and a controller to populate data and return data via the Web Api.
These should not affect this problem (and work perfectly on my desktop PC).
Otherwise, this is just a standard VS2013 ASP.Net 4.5.1 project using an empty website with the Web Api option selected.
Is there a way to get this program to work on the hosting service?
I have created some custom error pages in a MVC4 project. I use Application_Error and also the HandleErrorAttribute for routing.
Also,
It works fine in my dev computer, under IIS 8.0
When I publish the project to the production server, under IIS 7.5, it shows the default error pages, not custom pages.
What am I missing?
<customErrors mode="On" defaultRedirect="~/Error/Error.html" redirectMode="ResponseRewrite">
<error redirect="~/Error/403.aspx" statusCode="403" />
<error redirect="~/Error/404.aspx" statusCode="404" />
<error redirect="~/Error/500.html" statusCode="500" />
</customErrors>
Create page 403.aspx in root directory "Error"
<%# Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html>
<html>
<head runat="server">
<meta name="viewport" content="width=device-width" />
<title>403 Not Found</title>
</head>
<body>
<%
Server.ClearError();
Response.Status = "403 - Forbidden: Access is denied.";
Response.StatusCode = 403;
%>
<div>
<h2>403 - Forbidden: Access is denied.</h2>
</div>
</body>
</html>
Remove any response code setting statement from the action method.
Like
Response.StatusCode = 404;
Remove it and give a try.
I have referenced multiple user controls within the web.config file, because I was receiving an error in the individual pages and they are used in multiple pages, the code I wrote is as follows:
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="IPAMControl" tagName="confirm_list" src="~/Controls/confirmed_participant_list.ascx"/>
<add tagPrefix="IPAMControl" tagName="contact_us" src="~/Controls/contact_us.ascx" />
<add tagPrefix="IPAMControl" tagName="erh_list" src="~/Controls/erh_list.ascx" />
<add tagPrefix="IPAMControl" tagName="graphic_with_thumbnail" src="~/Controls/graphic_with_thumbnail.ascx" />
<add tagPrefix="IPAMControl" tagName="header" src="~/Controls/header.ascx" />
<add tagPrefix="IPAMControl" tagName="footer" src="~/Controls/footer.ascx" />
<add tagPrefix="IPAMControl" tagName="main_tnavbar" src="~/Controls/main_tnavbar.ascx" />
<add tagPrefix="IPAMControl" tagName="program_header" src="~/Controls/program_header.ascx" />
<add tagPrefix="IPAMControl" tagName="program_list" src="~/Controls/program_list.ascx" />
<add tagPrefix="IPAMControl" tagName="signup_section" src="~/Controls/signup_section.ascx" />
<add tagPrefix="IPAMControl" tagName="speaker_list" src="~/Controls/speaker_list.ascx" />
<add tagPrefix="IPAMControl" tagName="track" src="~/Controls/track.ascx" />
</controls>
</pages>
However, when I go into the HTML markup file (aspx) and beging typing "<IPAM..." nothing appears and I get an error of "Unrecognized namespace 'IPAMControls'.
Below is a sample page I am trying to insert one of the controls into:
<%# Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterNew.master" CodeFile="~/programs/programs.aspx.cs" Inherits="IPAM.Website.programs.programs" %>
<asp:Content ID="MainContent" ContentPlaceHolderID="Main" Runat="Server">
<h1>Upcoming Programs</h1>
<hr size="1">
<p align="center">Long Programs | Workshops | Affiliates' & Other Workshops | Summer Programs & Special Events
</p>
Our upcoming programs include long programs, short programs (workshops), reunion conferences, and summer programs. Click on the program title for detailed information.
<%--<a name="long"><ipam:program_list id="idProgramList1" Type="Long" Time="Upcoming" runat="server" /></a>
<a name="workshops"><ipam:program_list id="idProgramList2" Type="Short" Time="Upcoming" runat="server" /></a>
<a name="affiliate"><ipam:program_list id="idProgramList3" Type="Affiliate" Time="Upcoming" runat="server" /></a>
<a name="summer"><ipam:program_list id="idProgramList5" Type="Summer" Time="Upcoming" runat="server" /></a>
<a name="special"><ipam:program_list ID="idProgramList6" Type="Special" Time="Upcoming" runat="server" /></a>--%>
</asp:Content>
What am I doing wrong or missing.
You use user controls like this:
<IPAMControl:confirm_list ID="<id>" runat="server"></IPAMControl:confirm_list>
I use VS2008 and it doesn't come up in my intellisense either.
[Edit]
<%# Page Title="" Language="VB" MasterPageFile="~/MasterPage.master"
AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="accesscontrol_test" %>
<%# Register TagPrefix="IPAMControl" TagName="confirm_list" Src="Copy of nav.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="NEContent" Runat="Server">
<h1>Upcoming Programs</h1>
<hr size="1">
<p align="center"><a href="#long" >Long Programs</a></p>
Our upcoming programs include long programs, short programs (workshops), reunion
conferences, and summer programs. Click on the program title for detailed information.
<a name="long"><IPAMControl:confirm_list id="idconfirm_list" runat="server">
</IPAMControl:confirm_list></a>
</asp:Content>
The above code works fine for me, try registering it at the top of the page like I did, then we can help pinpoint what's causing the issue. You'll obviously have to change the directives, but register it in the page and not the web config.
[Edit]
Try adding this to your web config in <pages><controls>
<add tagPrefix="IMAPControl" namespace="IMAP.Webmaster.Controls" assembly="IMAP.Webmaster" />