Home > Mobile >  An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not han
An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not han

Time:12-31

I've created .aspx file in subdirectory of root. When I try to access it, I get

An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not handled in user code
Additional information: The 'href' property had a malformed URL: Cannot use a leading .. to 
exit above the top directory..

When I tried to change .aspx's contents to plain text, it worked. But when I put ASP tags in it, it don't.

Here's code:

<%@ Page Title="Articles!" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="12-28-2021_11-13AM.aspx.cs" Inherits="WebSite._1.Articles" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <hgroup >
        <h1><%: Title %></h1>
    </hgroup>
</asp:Content>

One of the answers I got is to change "~" to "..", and that didn't worked either.

CodePudding user response:

Looks like the issue was about Site.Master file. Problem was resolved by replacing ".." with "~" in hrefs in Site.Master file.

  • Related