---
title: "Uptime"
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/64077-uptime"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "omen"
published: "2003-01-07T17:25:50.000Z"
updated: "2003-01-07T19:46:15.000Z"
replies: 11
views: 317
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/64077-uptime"
---

# Uptime

## #1 — omen, 2003-01-07T17:25Z

Får det inte å funka när den ska visa min servers uptime.
Använder denna koden:

\<script language="c#" runat="server"\>
	void Page_Load()
	{
		TimeSpan ts = TimeSpan.FromMilliseconds(Environment.TickCount);
	      ltlUptime.Text = "The Web server has been running for:\<br\>" +
			ts.Days.ToString() + " days, " + 
			ts.Hours.ToString() + " hours, and " + 
			ts.Minutes.ToString() + " minutes.";
	}
\</script\>

\<asp:literal id="ltlUptime" runat="server" /\>

Men får detta felmess när jag ska testa sidan:

Error Type:
Active Server Pages, ASP 0129 (0x80004005)
The scripting language 'c#' is not found on the server.
/test/index.asp, line 6

Min serverdator kör Win2k Adv Server med .NET Framework + SP2.

Nån som vet varför det inte funkar?

Permalänk: https://www.webforum.nu/p/64077

## #2 — Josef, 2003-01-07T17:27Z

Re: Uptime

> **omen skrev:**
>
> Error Type:
> Active Server Pages, ASP 0129 (0x80004005)
> The scripting language 'c#' is not found on the server.
> /test/index.asp, line 6

Har du provat att ändra filnamnet till .aspx?

Permalänk: https://www.webforum.nu/p/904195

## #3 — cyprys, 2003-01-07T17:28Z

/r  :r

Permalänk: https://www.webforum.nu/p/904198

## #4 — omen, 2003-01-07T17:30Z

Bytt till .aspx nu
Men då kommer detta upp:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: path2

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 

\[ArgumentNullException: Value cannot be null.
Parameter name: path2\]
   System.IO.Path.Combine(String path1, String path2) +419
   System.Web.FilePathParse..ctor(String path, Boolean isFile, Boolean getShortNames) +366
   System.Web.FileChangesMonitor.StartMonitoringDirectoryRenamesAndBinDirectory(String dir, FileChangeEventHandler callback) +46
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +324

\[HttpException (0x80004005): ASP.NET Initialization Error\]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +927
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +128

 

 :l

Permalänk: https://www.webforum.nu/p/904202

## #5 — Brimba, 2003-01-07T17:41Z

Såhär skulle du kunna göra:

```
<script language="c#" runat="server">
	void [b]Page_Load(Object source, EventArgs e)[/b]
	{
		TimeSpan ts = TimeSpan.FromMilliseconds(Environment.TickCount);
	      ltlUptime.Text = "The Web server has been running for:<br>" +
			ts.Days.ToString() + " days, " + 
			ts.Hours.ToString() + " hours, and " + 
			ts.Minutes.ToString() + " minutes.";
	}
</script>

<asp:literal id="ltlUptime" runat="server" />
```

Permalänk: https://www.webforum.nu/p/904219

## #6 — omen, 2003-01-07T18:45Z

Får samma fel där
Har jag gjort nåt annat fel kanske.

Hur ska hela koden se ut om jag bara ska ha en tom vit sida där det står min uptime.

Behöver jag bara  denna koden:

\<script language="c#" runat="server"\>
	void Page_Load(Object source, EventArgs e)
	{
		TimeSpan ts = TimeSpan.FromMilliseconds(Environment.TickCount);
	      ltlUptime.Text = "The Web server has been running for:\<br\>" +
			ts.Days.ToString() + " days, " + 
			ts.Hours.ToString() + " hours, and " + 
			ts.Minutes.ToString() + " minutes.";
	}
\</script\>

\<asp:literal id="ltlUptime" runat="server" /\>

Eller måste det va nån annan kod me???

Permalänk: https://www.webforum.nu/p/904270

## #7 — Brimba, 2003-01-07T18:49Z

Föjande sida: <http://forum.brimba.nu/uptime.aspx>
innehåller följande kod:

```
<script language="c#" runat="server">
	void Page_Load(Object source, EventArgs e)
	{
		TimeSpan ts = TimeSpan.FromMilliseconds(Environment.TickCount);
	      ltlUptime.Text = "The Web server has been running for:<br>" +
			ts.Days.ToString() + " days, " + 
			ts.Hours.ToString() + " hours, and " + 
			ts.Minutes.ToString() + " minutes.";
	}
</script>

<asp:literal id="ltlUptime" runat="server" />
```

Permalänk: https://www.webforum.nu/p/904274

## #8 — omen, 2003-01-07T18:56Z

Min uptime.aspx ser EXAKT likadan ut.
Men får fortfarande samma fel  :( 

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

Value cannot be null. Parameter name: path2 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: path2

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 

\[ArgumentNullException: Value cannot be null.
Parameter name: path2\]
   System.IO.Path.Combine(String path1, String path2) +419
   System.Web.FilePathParse..ctor(String path, Boolean isFile, Boolean getShortNames) +366
   System.Web.FileChangesMonitor.StartMonitoringDirectoryRenamesAndBinDirectory(String dir, FileChangeEventHandler callback) +46
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +324

\[HttpException (0x80004005): ASP.NET Initialization Error\]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +927
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +128

 

 :(  :(  :(

Permalänk: https://www.webforum.nu/p/904285

## #9 — Brimba, 2003-01-07T19:12Z

Sker det på fler sidor? Har du kollat din machine.config/web.config osv?

Permalänk: https://www.webforum.nu/p/904300

## #10 — omen, 2003-01-07T19:16Z

> **Brimba skrev:**
>
> Sker det på fler sidor? Har du kollat din machine.config/web.config osv?

Fattar inte nåt av machine.config och web.config =/
Jag har bara en aspx sida och den funkar inte.
Alla vanliga asp sidor funkar perfekt.

Permalänk: https://www.webforum.nu/p/904301

## #11 — niko, 2003-01-07T19:21Z

Problem och lösning finns beskrivet här: <http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q320117>.

Permalänk: https://www.webforum.nu/p/904303

## #12 — omen, 2003-01-07T19:46Z

Tack!! 
Nu funkar det!! 
J---a Microsoft! :e

Permalänk: https://www.webforum.nu/p/904329

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/64077-uptime
