p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Beginning ASP.NET 4.5 : in C# and VB (http://p2p.wrox.com/book-beginning-asp-net-4-5-c-vb-710/)
-   -   First exemple = problems (http://p2p.wrox.com/book-beginning-asp-net-4-5-c-vb/99602-first-exemple-problems.html)

I Get Money August 24th, 2017 12:11 AM

First exemple = problems
 
Hi l'm using Visual Studio 2017 Community on windows 10 home.

I try the first exemple but the Asp.net code refuse to be execute on the web page <%Datetime.now.toString() %>. So i'm leave with a page with Welcome to beginning ASP.Net 4.5.

This is an exemple of the output window

Severity Code Description Project File Line Suppression State
Error NuGet Package restore failed for project WebSiteVB1: Unable to find version '1.2.0' of package 'Respond'. C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Respond.1.2.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'. https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request. The remote name could not be resolved: 'api.nuget.org'.

Severity Code Description Project File Line Suppression State
Error NuGet Package restore failed for project WebSiteVB1: Unable to find version '1.2.0' of package 'Respond'. C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Respond.1.2.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'. https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request. The remote name could not be resolved: 'api.nuget.org'.

Severity Code Description Project File Line Suppression State
Error NuGet Package restore failed for project WebSiteVB1: Unable to find version '2.2.1' of package 'Microsoft.AspNet.Identity.Owin'. C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.Identity.Owin.2.2.1' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'. https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request. The remote name could not be resolved: 'api.nuget.org'.

Imar August 24th, 2017 10:10 AM

Hi there,

Sounds like an issue with your network? Take a look at this:

>> Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request. The remote name could not be resolved: 'api.nuget.org'.

It seems it can't access the internet to download required packages.

Which commands did you choose to create the new site? File | New Project? Or File | New Website? Or something else?

Imar

I Get Money August 24th, 2017 11:49 PM

Asp is not showing
 
Hi

It cleared a lot of errors messages once i was connected but still the asp code is not executed in default.aspx

I created a website

This is the code:

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

<div class="jumbotron">
<h1>ASP.NET</h1>
<p><%Date.Today.ToString()%></p>

<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript.</p>
<p><a href="http://www.asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p>
</div>

<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>
ASP.NET Web Forms lets you build dynamic websites using a familiar drag-and-drop, event-driven model.
A design surface and hundreds of controls and components let you rapidly build sophisticated, powerful UI-driven sites with data access.
</p>
<p>
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301948">Learn more &raquo;</a>
</p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
</p>
<p>
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301949">Learn more &raquo;</a>
</p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>

<p>
You can easily find a web hosting company that offers the right mix of features and price for your applications.
</p>
<p>
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301950">Learn more &raquo;</a>
</p>
</div>
</div>

</asp:Content>


Only error i got was

Severity Code Description Project File Line Suppression State
Message IDE0017 Object initialization can be simplified WebSite3 C:\Users\Eric\source\WebSites\WebSite3\App_Code\Ro uteConfig.vb 8 Active

Imar August 25th, 2017 03:54 AM

You're missing the colon in your code block which is responsible for the output. I.e. this:

<p><%Date.Today.ToString()%></p>

should be this:

<p><%:Date.Today.ToString()%></p>

Also, the book uses DateTime.Now.ToString() so it works for VB and C#; your example should work too.

Imar

I Get Money August 26th, 2017 11:16 PM

Thanks
 
Thanks Imar


All times are GMT -4. The time now is 02:36 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.