Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 31st, 2010, 11:07 AM
Authorized User
 
Join Date: Aug 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Pg 255 Get an error when I Navigate to pages

I get the following error when I navigate to a new page. I check the code and gave the pages a valid title. I missing something. Can you help me. This occur with all the pages on page 254, step 3.


Server Error in '/' Application.
--------------------------------------------------------------------------------

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /Login.aspx


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
 
Old August 31st, 2010, 11:10 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Is the error message correct? That is, is there no Login.aspx in the root of your site? You added one in Chapter 6.

And can you provide more information? Maybe post the code for the sitemap, the web.config and the page you're working with?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 31st, 2010, 12:53 PM
Authorized User
 
Join Date: Aug 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
  <siteMapNode url="~/" title="Home" description="Home">
    <siteMapNode url="~/Default.aspx" title="Home" description="Go to the homepage" />
    <siteMapNode url="~/Reviews/Default.aspx" title="Reviews" description="Reviews published on this site">
      <siteMapNode url="~/Reviews/AllByGenre.aspx" title="By Genre" description="All Reviews Grouped by Genre" />
      <siteMapNode url="~/Reviews/All.aspx" title="All Reviews" description="All Reviews" />
    </siteMapNode>
    <siteMapNode url="~/About/Default.aspx" title="About" description="About this Site">
      <siteMapNode url="~/About/Contact.aspx" title="Contact Us" description="Contact Us" />
      <siteMapNode url="~/About/AboutUs.aspx" title="About Us" description="About Us" />
    </siteMapNode>
    <siteMapNode url="~\Login.aspx" title="Login" description="Log in to this web site" />
  </siteMapNode>
</siteMap>
Webconfig
Code:
 <?xml version="1.0"?>
<configuration>
	<system.web>
		<compilation debug="true" targetFramework="4.0"/>
	</system.web>
</configuration>

Error

Server Error in '/' Application.
--------------------------------------------------------------------------------

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /About/Contact.aspx


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.3

I was stating that all the page I create on page 254 and 255 including the login.aspx page will encounter an erorr. I'm on page 255 at step 4 and common mistakes. I open the default.aspx page and navigated to one of the new pages I created and get the error.
 
Old August 31st, 2010, 12:56 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
I open the default.aspx page and navigated to one of the new pages I created
Which one?

It makes sense if you get this error when a) you click the Login item an b) you didn't create that file in Chapter 6. Did you create Logn.aspx?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 31st, 2010, 12:58 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
Requested URL: /About/Contact.aspx
Oh, I see now you run into this for other pages as well.

Did you set the Virtual Path? What do you see in the browser's address bar when you open the first page in the browser? And can you post the final HTML for that page with the menu?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 31st, 2010, 02:03 PM
Authorized User
 
Join Date: Aug 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Question

Yes the virtual path is set to /

The path for the default.aspx is

http://localhost:4875/MasterPages/Default.aspx

The path for Contact.aspx when I click the menu is

http://localhost:4875/About/Contact.aspx


The code from view > source in brower. I'm new at this. I guess this is the HTML you are talking about

Code:
 <!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><title>
	Welcome to Maintenance Request Form
</title>
    <style type="text/css">
        .style1
        {
            color: #FF0000;
        }
        .style2
        {
            color: #000000;
            text-align: center;
            font-size: xx-large;
        }
    </style>
<link href="../App_Themes/Hyattsville/Hyattsville.css" type="text/css" rel="stylesheet" /><style type="text/css"> 
	/* <![CDATA[ */
	#Menu1 img.icon { border-style:none;vertical-align:middle; }
	#Menu1 img.separator { border-style:none;display:block; }
	#Menu1 img.horizontal-separator { border-style:none;vertical-align:middle; }
	#Menu1 ul { list-style:none;margin:0;padding:0;width:auto; }
	#Menu1 ul.dynamic { z-index:1; }
	#Menu1 a { text-decoration:none;white-space:nowrap;display:block; }
	#Menu1 a.static { padding-left:0.15em;padding-right:0.15em; }
	#Menu1 a.popout-dynamic { background:url("/WebResource.axd?d=BeWUWlpBaKnokMRtrdtScCqzv7UlEYF_i5WmUtpMd8k1&t=634105684041007634") no-repeat right center;padding-right:14px; }
	/* ]]> */
</style></head>
<body>
    <form method="post" action="Default.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTY1NDU2MTA1Mg9kFgJmD2QWAgIDD2QWBgIDDzwrAA0CAA8WAh4LXyFEYXRhQm91bmRnZAwUKwAFBQ8wOjAsMDoxLDA6MiwwOjMUKwACFhAeBFRleHQFBEhvbWUeBVZhbHVlBQRIb21lHgtOYXZpZ2F0ZVVybAUNL0RlZmF1bHQuYXNweB4HVG9vbFRpcAUSR28gdG8gdGhlIGhvbWVwYWdlHgdFbmFibGVkZx4KU2VsZWN0YWJsZWceCERhdGFQYXRoBQ0vZGVmYXVsdC5hc3B4HglEYXRhQm91bmRnZBQrAAIWEB8BBQdSZXZpZXdzHwIFB1Jldmlld3MfAwUVL1Jldmlld3MvRGVmYXVsdC5hc3B4HwQFHlJldmlld3MgcHVibGlzaGVkIG9uIHRoaXMgc2l0ZR8FZx8GZx8HBRUvcmV2aWV3cy9kZWZhdWx0LmFzcHgfCGcUKwADBQcwOjAsMDoxFCsAAhYQHwEFCEJ5IEdlbnJlHwIFCEJ5IEdlbnJlHwMFGC9SZXZpZXdzL0FsbEJ5R2VucmUuYXNweB8EBRxBbGwgUmV2aWV3cyBHcm91cGVkIGJ5IEdlbnJlHwVnHwZnHwcFGC9yZXZpZXdzL2FsbGJ5Z2VucmUuYXNweB8IZ2QUKwACFhAfAQULQWxsIFJldmlld3MfAgULQWxsIFJldmlld3MfAwURL1Jldmlld3MvQWxsLmFzcHgfBAULQWxsIFJldmlld3MfBWcfBmcfBwURL3Jldmlld3MvYWxsLmFzcHgfCGdkFCsAAhYQHwEFBUFib3V0HwIFBUFib3V0HwMFEy9BYm91dC9EZWZhdWx0LmFzcHgfBAUPQWJvdXQgdGhpcyBTaXRlHwVnHwZnHwcFEy9hYm91dC9kZWZhdWx0LmFzcHgfCGcUKwADBQcwOjAsMDoxFCsAAhYQHwEFCkNvbnRhY3QgVXMfAgUKQ29udGFjdCBVcx8DBRMvQWJvdXQvQ29udGFjdC5hc3B4HwQFCkNvbnRhY3QgVXMfBWcfBmcfBwUTL2Fib3V0L2NvbnRhY3QuYXNweB8IZ2QUKwACFhAfAQUIQWJvdXQgVXMfAgUIQWJvdXQgVXMfAwUTL0Fib3V0L0Fib3V0VXMuYXNweB8EBQhBYm91dCBVcx8FZx8GZx8HBRMvYWJvdXQvYWJvdXR1cy5hc3B4HwhnZBQrAAIWEB8BBQVMb2dpbh8CBQVMb2dpbh8DBQsvTG9naW4uYXNweB8EBRdMb2cgaW4gdG8gdGhpcyB3ZWIgc2l0ZR8FZx8GZx8HBQsvbG9naW4uYXNweB8IZ2RkAgUPPCsACQIADxYEHg1OZXZlckV4cGFuZGVkZx4HVmlzaWJsZWhkBxAWABYAZGQCCQ8QZGQWAWZkZMFixXVUI/f2Cx+gvLSZdntei4dfIXsL/V/S/LCckKw6" />
</div>
 
<script type="text/javascript"> 
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>
 
 
 
<script src="/WebResource.axd?d=ZQegwkn4bzkd_ZSvJfwYAP75A07-9X7dKWobbDXmdAI1&amp;t=634105684041007634" type="text/javascript"></script>
<div class="aspNetHidden">
 
	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBAL/5fPiBwKUw8moBALQlLO+CgL8+YfuD2K0nHsRXNcCWb88+fQ3W3A5dMdzL4nXOnT26iQbJ8SK" />
</div>
      <div id ="Pagewrapper">
    <div id="Header"> <a href="../"></a></div>
    <div id="MenuWrapper">
     <a href="#Menu1_SkipLink"><img alt="Skip Navigation Links" src="/WebResource.axd?d=dDrRxtbrQoRmTZvGYnvUmQ2&amp;t=634105684041007634" width="0" height="0" style="border-width:0px;" /></a><div class="MainMenu" id="Menu1">
	<ul class="level1">
		<li><a title="Go to the homepage" class="level1" href="/Default.aspx">Home</a></li><li><a title="Reviews published on this site" class="level1" href="/Reviews/Default.aspx">Reviews</a><ul class="level2">
			<li><a title="All Reviews Grouped by Genre" class="level2" href="/Reviews/AllByGenre.aspx">By Genre</a></li><li><a title="All Reviews" class="level2" href="/Reviews/All.aspx">All Reviews</a></li>
		</ul></li><li><a title="About this Site" class="level1" href="/About/Default.aspx">About</a><ul class="level2">
			<li><a title="Contact Us" class="level2" href="/About/Contact.aspx">Contact Us</a></li><li><a title="About Us" class="level2" href="/About/AboutUs.aspx">About Us</a></li>
		</ul></li><li><a title="Log in to this web site" class="level1" href="/Login.aspx">Login</a></li>
	</ul>
</div><a id="Menu1_SkipLink"></a>     
        
            
            </div>
<div id ="Sidebar">Selection Location:<br />
<select name="ctl00$ThemeList" onchange="javascript:setTimeout('__doPostBack(\'ctl00$ThemeList\',\'\')', 0)" id="ThemeList">
	<option selected="selected" value="Hyattsville">Hyattsville</option>
	<option value="RTP">RTP</option>
 
</select>
    </div>
    <div id="MainContent"> 
        <span id="SiteMapPath1"><a href="#SiteMapPath1_SkipLink"><img alt="Skip Navigation Links" height="0" width="0" src="/WebResource.axd?d=dDrRxtbrQoRmTZvGYnvUmQ2&amp;t=634105684041007634" style="border-width:0px;" /></a><a id="SiteMapPath1_SkipLink"></a></span><br /><br />
         
    <h1 class="style2">
   Welcome to the Maintenance Request Form</h1>
<p>For an <span class="style1">EMERGENCY</span> or <span class="style1">URGENT</span> 
    matter Call Facility Management at: RTP: 919-541-2773
     HYATTSVILLE: 301-458-4471 
    &quot;or&quot; 301-458-4482
</p>
 
      </div>
    
    <div id ="Footer">Footer Goes Here</div>
      </div>
    
<script type='text/javascript'>new Sys.WebForms.Menu({ element: 'Menu1', disappearAfter: 500, orientation: 'horizontal', tabIndex: 0, disabled: false });</script></form>
</body>
 
Old August 31st, 2010, 02:35 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Take a look at this:

http://localhost:4875/MasterPages/Default.aspx

You somehow ended up with the page in the MasterPages folder, while the rest of the layout assumes the file is located in the root. It's hard for me to guess the real problem without some more information, such as :

1. How does your site look on disk? E.g. where did you store the files? Where are web.config and other root files located physically?

2. When you choose File | Open Web Site, which folder do you choose? That folder defines the "root" of the site.

3. Did you create Login.aspx?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old September 1st, 2010, 12:46 AM
Authorized User
 
Join Date: Aug 2010
Posts: 10
Thanks: 0
Thanked 1 Time in 1 Post
Default

Code:
<siteMapNode url="~\Login.aspx" title="Login" description="Log in to this web site" />
Need to change that to a /Login.aspx.
 
Old September 7th, 2010, 12:00 PM
Authorized User
 
Join Date: Aug 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Navigation to pages work

The navigation works I stored the files wrong. Thank you.





Similar Threads
Thread Thread Starter Forum Replies Last Post
An error found on page 255? bert BOOK: Professional C++ 5 July 15th, 2010 09:09 AM
Display ASCII chars (128 to 255) in a TextBox JerrySykes Beginning VB 6 8 August 6th, 2007 10:47 AM
255 character limit in datagrid boundfield poogles ASP.NET 2.0 Basics 0 July 16th, 2007 04:18 PM
SQL statement limited to 255 chars Mikeopolo Excel VBA 1 February 18th, 2005 09:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.