C# - Cache Key Causes Error "Negating The Minimum Value Of A Twos Complement Number Is Invalid"?

Sep 1, 2010

This is one of the strangest errors I've ever seen.

I'm doing a very simple call to return values from the HttpRuntime cache. The call is:

return HttpContext.Current.Cache[cacheKey];

If it returns null, that's fine. I check if the returned value is null and act accordingly. I've been using this call for a long time.

Recently, for some reason, when cacheKey is set to this exact value:

"Topic_GridSelectAll:5,null,2010-08-31-20-00-00,Published,desc,5,1"

a System.OverflowException is thrown: Negating the minimum value of a twos complement number is invalid.

Nothing about the call, associated code or server has changed. If the cacheKey has slightly different characters, it works perfectly fine. For instance, this cacheKey returns null without throwing any exception:

"Topic_GridSelectAll:5,null,2010-08-31-21-00-00,Published,desc,5,1"

Notice, the only difference between those two strings is the time characters: 2010-08-31-20-00-00 versus 2010-08-31-21-00-00.

Why the hell would that make any difference? And why now after all this time?

The stack trace is:

[OverflowException: Negating the minimum value of a twos complement number is invalid.]
System.Math.AbsHelper(Int32 value) +12753486
System.Web.Caching.CacheMultiple.UpdateCache(CacheKey cacheKey, CacheEntry newEntry, Boolean replace, CacheItemRemovedReason removedReason, Object& valueOld) +142
System.Web.Caching.CacheInternal.DoGet(Boolean isPublic, String key, CacheGetOptions getOptions) +122
MyProject.Helpers.CacheHelper.GetData(String cacheDomain, String cacheKey) in ...

I've tried changing the cache call to use HttpRuntime.Cache instead (ie. HttpRuntime.Cache[cacheKey]), but that made no difference. I know it's the same underlying cache provider, but I thought maybe the different call would make a difference.

View 1 Replies


Similar Messages:

AJAX :: Error "Invalid Home Number. Number Should Be In The Format: 555-123-4567" With MaskedEditExtender

Oct 28, 2010

My requirement is, I have one text box and that text box accepts US Format 10 digit phone number like 555-555-5555. I want when user enter 5555555555 it automatically convert this in 555-555-5555 and if he enter some wrong number then show him error and if dont want to enter any thing then there should not be any error.

<th style="width: 150px">Home Telephone </th>
<td>
<asp:TextBox ID="txtHome" runat="server" MaxLength="12" ValidationGroup="vUserDetailsB" Width="252px" CssClass="txtBox" TabIndex="19"></asp:TextBox>
<cc1:MaskedEditExtender ID="meeHome" runat="server" TargetControlID="txtHome"
AutoComplete="false" MaskType="None" Mask="999-999-9999" ClearMaskOnLostFocus="true" InputDirection="LeftToRight" />
<%-- <cc1:MaskedEditValidator ID="mevHome" runat="server" ControlToValidate="txtHome"
EmptyValueMessage="Telephone Number is required." ValidationGroup="vUserDetailsB"
ControlExtender="meeHome" InvalidValueMessage="Valid Telephone Number is required."
IsValidEmpty="false" ValidationExpression="^d{3}-d{3}-d{4}&#36;" Font-Size="8pt" />--%>
<asp:RegularExpressionValidator ID="revHome" runat="server" ControlToValidate="txtHome" Display="Dynamic" ErrorMessage="Invalid Home number. Number should be in the format: 555-123-4567" Font-Size="8pt" SetFocusOnError="True" ValidationExpression="d{3}-d{3}-d{4}"
ValidationGroup="vUserDetailsB" Width="100%" meta:resourcekey="txtHomeResource1"></asp:RegularExpressionValidator>
</td>

Whats happenening, If i entered any thing like 5555555555 and it is coverting to this 555-555-5555 format which is correct and then when i moved to another textbox it is throwing error "Invalid Home number. Number should be in the format: 555-123-4567" and this format changes to 5555555555 and its not going ahead.

View 3 Replies

WCF / ASMX :: XML Parsing Error: Reference To Invalid Character Number

Feb 17, 2011

Actually i m working with web service , and it retun me encripted password but it give me error when i run,

XML Parsing Error: reference to invalid character number

Location: http://localhost:2774/EncriptPWD/Service.asmx/EncriptPWD
Line Number 2, Column 47:<string xmlns="http://tempuri.org/">????????A???5??!??`??

View 2 Replies

Web Forms :: RequiredFieldValidator Minimum 6 Number?

Aug 28, 2010

This my code:

[code]...

View 5 Replies

Error - Compiler Error Message - CS1525: Invalid Expression Term

Apr 22, 2010

<%# Eval("NAME").ToString() == "Edit" ? %>
<asp:ImageButton ID="imgEdit" runat="server" ImageUrl="../icons/icoedit.png" CommandName="Edit" CommandArgument='<%# Container.DataItemIndex %>' />

Error: Compiler Error Message: CS1525: Invalid expression term ',

View 2 Replies

C# - FormsAuthenticationTicket.Version Returns Invalid Version Number

Mar 8, 2011

Is there any limit on the size/numbers in the version number of the FormsAuthenticationTicket.

I tried to create an ASP.NET cookie using forms authentication, with a large version number(ex: 1234567 need this number for identification purposes). But when I decrypt the cookie I get 135 as the version number.

Initially the old forms authentication cookie was removed, in order to add new information.

Response.Cookies.Remove(FormsAuthentication.FormsCookieName);

Following is the code I used to create the FormsAuthentication cookie.

FormsAuthenticationTicket newAuthTicket = new FormsAuthenticationTicket(1234567, un, DateTime.Now, DateTime.Now.AddHours(5F), false, user_data);
HttpCookie newauthCookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(newAuthTicket));
Response.Cookies.Add(newauthCookie);

After retrieving the cookie, the version number I got was 135. This number varies with different version numbers.

string cookieName = FormsAuthentication.FormsCookieName;
HttpCookie authCookie = Context.Request.Cookies[cookieName];

if (authCookie == null)
{
return;
}
FormsAuthenticationTicket authTkt = null;
authTkt = FormsAuthentication.Decrypt(authCookie.Value);
if (authTkt == null)
{
return;
}
int versionID = authTkt.Version;

Can someone let me know if it's a bad idea to use such big version numbers, or am I missing something in this.

View 1 Replies

Error - Invalid Value For Key 'attachdbfilename'

Jan 22, 2011

Connection String:

data source=mssql2008.chaiyohosting.com;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true

Error:

Invalid value for key 'attachdbfilename'.

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

Exception Details: System.ArgumentException: Invalid value for key 'attachdbfilename'.

Source Error:

Line 20: protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
Line 21: {
Line 22: if (Membership.ValidateUser(Login1.UserName, Login1.Password))
Line 23: {
Line 24: e.Authenticated = true;

Source File: c:inetpubvhostsvcantop.comhttpdocsDefault.aspx.cs Line: 22

Stack Trace:

[code]....

View 1 Replies

Error - Invalid Object Name 'UserLock'

Aug 20, 2010

I am trying to execute a CREATE TABLE which results in the following SQL exception:

Invalid object name 'UserLock'.

The statement looks like this:

USE [db]
GO
CREATE TABLE [db].[dbo].[UserLock] (
[Login] [varchar](150) NOT NULL,
[ExpirationDate] [datetime] NOT NULL,
CONSTRAINT [PK_UserLock] PRIMARY KEY CLUSTERED
([Login] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

The strange part is that I can run the query successfully inside the Microsoft SQL Management Studio with the same user but not within my .NET web application written in C#. I am not using any frameworks and I connect to the database with the provided classes out of System.Data.SqlClient. All other database queries work within the app. The database is Microsoft SQL Express 2005.

-- Edit ---

This is how my execution code looks like:

string createString = "CREATE TABLE [" + catalog + "].[dbo].[UserLock]("
+ " [Login] [varchar](150) NOT NULL,"
+ " [ExpirationDate] [datetime] NOT NULL,"
+ " CONSTRAINT [PK_UserLock] PRIMARY KEY CLUSTERED "
+ " ([Login] ASC)"
+ " WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]"
+ ") ON [PRIMARY]";
SqlCommand createCommand = connection.CreateCommand();
createCommand.Connection = connection;
createCommand.CommandText = createString;
selectCommand.ExecuteNonQuery();

I catch the exception in another method. The SQL connection itself is beeing set up in antoher method, aswell. It's the standard SqlConnection connection = new SqlConnection(connectionString);

View 3 Replies

Getting The Error ') Expected' And 'Invalid Expression )'

May 18, 2010

I keep getting the error ') expected' and 'Invalid expression )' on the following code:

[Code]....

View 8 Replies

.net - Invalid Viewstate Error - OnPreRender?

Jan 19, 2010

I'm getting 100+ errors per day on my website with System.Web.HttpException: Invalid viewstate. The website is asp.net 3.5 running on iis6 , not running in a web-garden/web-farm , single server.Here are a few sample errors.

Machine: ML Framework Version: 2.0.50727.3603 Assembly Version: 6.5.3664.33889
Source: http://www.domain.com/WebResource.axd?d=z5VmXXoSLLpQHoPictureAlert
Exception: System.Web.HttpException: Invalid viewstate. at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType) at

i already tried wraping all inline javascript with //<![CDATA[ //]]>

i already set enableViewStateMac to false.From looking at all the errors guessing out of the "d" paramter it seems to focus on a single usercontrol on my website.in this control i change the visiblity of div's + text in the usercontrol OnPreRender function.

protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
PreparePage();
}
Can the errors be related to the usercontrol behavioral?

View 2 Replies

Security :: Getting Error/Padding Is Invalid And Cannot Be Removed.

Jan 15, 2010

I have all application errors sent to my email. I keep getting this:

mysite.com/webresource.axd?d=yacsx7hz0irzn_i7ifr3morrek9u6srdkqxsjvpn3mw1&t=633598204507656250
Padding is invalid and cannot be removed.

[Exception Info]

Stack Trace: at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
[code]....

i googled and read to add machineKey in my web.config <system.web> which i did:
<machineKey validationKey='0EFA95136AEA44850D5CEDDF0CC7502B1A009.....' decryptionKey='E88EB13ADB2C3D395193AA71DBB1E...' validation='SHA1'/>

and added
<pages masterPageFile enableViewStateMac="true" viewStateEncryptionMode="Auto"> to my masterpage.But i keep getting that error.

View 2 Replies

DataPager Throws Error When QueryString Value Invalid

Mar 29, 2011

I am using a Datapager in my project with a ListView control. The Datapager is set to use a querystring value Page, so that a typical URL looks like: [URL]. The problem is that the ListView throws an ugly error if the pageview is invalid (0, for example).

The error is:
Specified argument was out of the range of valid values.
Parameter name: startRowIndex

The error originates in the ListView SetPageProperties method. What is the best way to address this? Can I override the SetPageProperties method in some way, to check the startRowIndex parameter? Here's a very simple page that replicates the error: [URL]. A copy of a simple webapplication project demonstrating the error: [URL]

View 1 Replies

Configuration :: Error: A Name Was Started With An Invalid Character

Apr 14, 2010

[Code]....

I have the above error while deploying the svc file via IIS 7 but when I deployed it via VS 2008 everything works ok.note I have checked the web site configuration to map to asp.net 2.0 and added the handler mapping for .svc file in IIS 7 but no luck.

View 8 Replies

Invalid Argument Javascript Error Only On Certain Computers?

Nov 18, 2010

Getting an error whenever we click a particular button/link on our site. It is generating a javascript "Invalid Argument" error. I know in the other posts it is typically because it is a syntax error in the javascript however it only just seems to have started happening and it doesn't happen on all pcs.

ie. in our client's environment if I remote onto their web server and view the uat website I get the javascript error. If I remote onto their sql server and view the uat website I don't get the javascript error. If it was a syntax error then I would always get the error wouldn't I?

both browsers are the same version of IE6 (yeah I know...) :) I have tried deleting temporary internet files - including viewing the files and deleting them myself - but no joy.

client uses citrix.. and they're all getting the error :(

Update - I haven't posted specific code as there is too much to post (and I'm not sure where the error is occurring). The "button" launches a new window which in turn opens up a couple of aspx pages and calls lots of javascript. So the window opens ok, and there's a function that gets called to resize the window - but before it calls the resizing of the window/content it throws the invalid argument error. Am busy trying to get alerts to trigger to see if I can see where it's falling over but so far no luck.

Again not sure why this error doesn't occur when I use a particular PC (same browser version)

View 3 Replies

C# - Stored Procedure Error :: Invalid Object Name?

Dec 4, 2010

fetching data from 2 tables in one Stored Proceure..what's wrong with the SP below ?

Its giving error as "Msg 208, Level 16, State 6, Procedure sp_GetID, Line 9
Invalid object name 'Admin.sp_GetID'."

ALTER PROCEDURE GetID
(
@ID int [code]....

I am altering a previously made procedure...All I changed was ..I added the second SELECt statment...just that...otherwise SP was executing

View 2 Replies

Invalid Viewstate Error EVENT # 31890?

Jul 23, 2010

got this error.solve this?

EVENT # 31890

EVENT LOG Application

EVENT TYPE Warning

OPCODE Info

[code]...

View 1 Replies

Web Forms :: Invalid Postback Or Callback Argument Error

Mar 26, 2010

When i tried to edit a record present in a gridview I am getting the following error "Invalid postback or callback argument.Event validation is enabled using <pages Enable event validation="true"/> in configuration or <% @ page EnableEventValidation="true" %> in a page.For security purposes,this feature verifies that arguments to postback or callback events originate from server control that originally render them.If data is valid and expected,use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation."

View 3 Replies

Web Forms :: Error On Invalid Value In Dropdown With Autopostback True

Feb 3, 2011

I am getting the following error as Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. when an invalid value is passed in dropdown with autopostback=true. What should I do. I want the solution with "EventValidation=true" and "ValidateRequest=true" in the Page directives. Also without any Custom Error Pages Enabled in web.config file i.e Custom Error Pages are off in web.config file.

View 3 Replies

WCF / ASMX :: WCF - Invalid Argument Error From Published WCF Service

Dec 20, 2010

I am making a call to a WCF service(Existing) from another WCF Service(New, my service), which is configured as Anonymous access. I did a service reference of my service to web application both under same solution file and web app is configured as Windows Authentication. When I call the existing WCF Service from my web app directly, everything works fine, but when I call the same existing WCF Service from my service, I got a "user does not have valid credentials" error. To avoid this error, I published my service to a server and referenced that URL to my web app. Though I got past the error, now, I am getting "Invalid Argument" error. No further information on the error.

Error source is MSCORLIB. There is no problem in the code of my service and the existing service, because if the same value that I get from the existing service is hard coded, then everything works fine. The existing service is used by many other app and it works fine. So, its a tested service. I tried to find a solution of "invalid argument" and I found few threads where others are facing the same problem when they publish a WCF service, but I did not find any proper solution for this.

View 1 Replies

XML - Invalid At The Top Level Of The Document - Error Processing Resource

Nov 9, 2010

what is wrong with the following Xml file?

<?xml version="1.0" encoding="utf-8"?>
<root>
<align>right</align>
<columns>3</columns>
<rows>4</rows>
<backgroundColor>#333333</backgroundColor>
<circleButtonColor>#666666</circleButtonColor>
<currentCircleButtonColor>#000000</currentCircleButtonColor>
<textColor>#000000</textColor>
<thumbWidth>100</thumbWidth>
<thumbHeight>75</thumbHeight>
<thumbPadding>10</thumbPadding>
<thumbBorder>3</thumbBorder>
<thumbBorderColor>#0000F1</thumbBorderColor>
<assetWidth>600</assetWidth>
<assetHeight>400</assetHeight>
<showImageCaption>yes</showImageCaption>
<showImageShadow>no</showImageShadow>
<target>_self</target>
</root>

And here is the error Invalid at the top level of the document. Error processing resource [URL]. Line 20, Positi... </root> I am sure i could use a break, but in case i don't, before i upload the specific file, i get no errors at localhost. UPDATE: After checking the Xml (Hex), i noticed that the character 0x00 (NULL) was added magically, after the </root> By saying Magically i mean... The XML file is created normally at localhost. The NULL character is appended by a custom FTP class, (which is used for upload - in binary mode), OR something else that i cannot imagine..

View 2 Replies

MVC :: Change Error For Invalid Type Input On Field

Aug 13, 2010

I'm using Data Annotations and Metadata attributes in my models to do automatic validations on my forms. Any who, I've got a problem where I have an int field I need to change the error when a letter is entered. Im guetting the default error: "The value 'A' is not valid for NĂºmero.". But since this is a spanish web, i need to change the error to something in spansih. Any who, I cant find where to change the ErrorMessage="" to what I need.

View 11 Replies

Prevent Error On Page When Resource Reference Is Invalid?

Sep 20, 2010

I'm using resources like this; " runat="server" />

Resources are maintained in a database and resourcefiles are generated when new translations are added. Sometimes bad references to keys happens. This results in error on the whole page.

How can I prevent the whole page from crashing when a resource does not exist? I just want a tiny error message where the resource lacks, like "Not found: Users.DetailsUserHeadline".

I also want to dynamically retrieve resources from code behind, by defining the key as a string "Users.DetailsUserHeadline" without any erros.

View 1 Replies

SQL Server :: Invalid Table Object - Error Message

Jan 6, 2011

I am somewhat new to c# so I am unfamiliar with data access. I have used PHP but it is obviously less strict of a language than any form of dot net. With some help I have put together a try/catch sequence that outputs the below error message using a 'sqlex.Message'

Invalid object name 'nwsb_tbUsers'.

I am a bit confused about the error message though because the "tbUsers" table does exist inside of my MDF database that I created it via FTP. Is something wrong with my connection string possibly?

<add name="connectionString_dbInfo" connectionString="Data
Source=tcp:s01.winhost.com;Initial Catalog=MYDBNAME_sql;User ID=MYUSERNAME;Password=MYPASSWORD;Integrated Security=False;" />

I copied this directly from my host so I would like to think that the connection string is correct. I can access the table and modify it via FTP.

View 9 Replies

DataSource Controls :: Getting Error That Invalid Column Name 'DateofBirth'

Feb 22, 2010

SqlConnection

Conne=new
SqlConnection(); [code]....

View 4 Replies

Error Invalid Date Format When Upload The Application

Jun 7, 2010

I had used Calendar control to enter Date. In localhost, when I save the date, it works fine and save the date. But when i had uploaded the application, it gives me error invalid date format. How to get rid of this error?

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved