Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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 February 5th, 2008, 01:42 AM
Authorized User
 
Join Date: Jan 2008
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default error msg

Hi,
Everything works fine when i run the website on my workstation.However,when i host the web in my webserver,this error pops out.please advice

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

Index and count must refer to a location within the string.
Parameter name: count 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.ArgumentOutOfRangeException: Index and count must refer to a location within the string.
Parameter name: count

Source Error:

Line 18: String username = Page.User.Identity.Name;
Line 19: username =username.Replace("GAR\\","");
Line 20: Label2.Text = username;
Line 21:
Line 22: Label2.Text = username.ToUpper();

Source File: c:\Inetpub\wwwroot\WebSite1\Default.aspx.cs Line: 20

Stack Trace:

[ArgumentOutOfRangeException: Index and count must refer to a location within the string.
Parameter name: count]
   System.String.Remove(Int32 startIndex, Int32 count) +0
   _Default.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\WebSite1\Default.aspx.cs:20
   System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436




 
Old February 5th, 2008, 11:04 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

That error description doesn't appear to match the code the error is displaying.

Tell us about how you set up your website/virtual directory/application.

-Peter
 
Old February 12th, 2008, 05:17 AM
Authorized User
 
Join Date: Jan 2008
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

when i run the website in my laptop,the website works perfectly.Now i want host it in a webserver,i've copied the whole web folder in the inetpub/wwwroot directory and configured to be application under IIS and it's giving me the error above.Pls advice.

 
Old February 12th, 2008, 08:34 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

What Peter is saying is that the error you are getting does not match this code:

Line 18: String username = Page.User.Identity.Name;
Line 19: username =username.Replace("GAR\\","");
Line 20: Label2.Text = username;
Line 21:
Line 22: Label2.Text = username.ToUpper();

Calling Replace() will not cause this type of error to be thrown. I most commonly see this error when working with SubString() trying to refer to a position in the string that doesn't exist.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========




Similar Threads
Thread Thread Starter Forum Replies Last Post
as,in and reference types error msg..... raykaash C# 2005 2 January 8th, 2008 07:14 AM
Error msg 3021 MathLearner VB Databases Basics 1 May 17th, 2007 07:41 AM
error msg aspsuraj BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 November 27th, 2006 08:30 PM
error msg not sure how to code this De-zypher Classic ASP Basics 1 May 24th, 2006 04:05 PM
Breakpoint Error Msg Louisa VB.NET 2002/2003 Basics 1 March 29th, 2004 06:42 AM





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