Showing posts with label website. Show all posts
Showing posts with label website. Show all posts

Wednesday, March 28, 2012

Viewstate verification failed - HELP my website is falling apart. Again :-(

I have a timer component that refreshes my page every minute but after a while it fails with the error "Viewstate verification failed". I left the page refreshing last night and it showed it stopped after 3 hours. The contents of the page haven't changed so I'm wondering if it is a timing issue with another component on my master page that has a javascript timer to which refreshes itself using callbacks.

The full error from my Event Viewer is:

Event Type: Information
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1316
Date: 15/02/2007
Time: 03:31:22
User: N/A
Computer: MAT
Description:
Event code: 4009
Event message: Viewstate verification failed. Reason: Viewstate was invalid.
Event time: 2/15/2007 3:31:22 a.m.
Event time (UTC): 2/14/2007 2:31:22 p.m.
Event ID: b68b7d7fa4d446b3adba40708b352b32
Event sequence: 341
Event occurrence: 1
Event detail code: 50204

Application information:
Application domain: /LM/W3SVC/1/Root/flo-1-128159266743963684
Trust level: Full
Application Virtual Path: /flo
Application Path: c:\inetpub\wwwroot\flo\
Machine name: MAT

Process information:
Process ID: 2308
Process name: aspnet_wp.exe
Account name: MAT\ASPNET

Request information:
Request URL:http://localhost/job_status.aspx
Request path: /job_status.aspx
User host address: 127.0.0.1
User: matthew
Is authenticated: True
Authentication Type: Forms
Thread account name: MAT\ASPNET

ViewStateException information:
Exception message: Invalid viewstate.
Client IP: 127.0.0.1
Port: 1349
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
PersistedState: /wEWBQK9m9+mCQL20L6+CQLh8tHdBgLd/pFuArD90/EPqAe+PBf42BwApxmU14Oldo6DzQU=
Referer:http://localhost/job_status.aspx
Path: /job_status.aspx

Custom event details:

For more information, see Help and Support Center athttp://go.microsoft.com/fwlink/events.asp.

Any help would be appreciated.

Hi Matthew,

I remember some time ago to find a similar problem. It had to do with the fact that viewstate is saved in a hidden field at the end of the page, and continuous AJAX refreshes queued successive requests before they were finished, at the point where the request still had to reach the "end" of the page, where the ViewState resides. As you can see, the ViewState validator couldn't do it's work and, therefore, it threw an exception like the one you are having.

If you search the forum you may find that thread, as I haven't started it I have no easy way to point you to the link. I think I remember there was a workaround as well.

Sorry not to be more helpful, but maybe at least I gave a direction to start looking at.

Regards,

Juan


Thanks for the info. I have set up two almost duplicate copies of the site, one with buffering and one without to see if that is causing invalid data. If that doesn't work I'll look for the thread you mentioned.


Have you figured this out yet? I'm seeing this intermittently and am not sure where it's coming from.

Thanks!


I have managed to resolve this problem by not having multiple types of callback components, ie AJAX and custom made callback scripts.

What I did in the end was to setup a timer on the masterpage. On the content pages if I want update panels to update I add a trigger to the update panel that is pointing to the timer on the masterpage. Therefore evry minute the timer on the masterpage refreshes all updatepanels that are connected to it.

If you need more info let me know and i'll sort some code out for you.

Virtual Earth - Pushpin Layer not Updated

i'm trying to implement geotagging on my website that allow my blog reader to add themselves to the map using pushpin.under my map i've several field for the users to key in their details then upon clicking the "add" button... their details will be appended to a georss xml file... and this step works fine as the details can be appended without problem... but when the page refreshes after my user hav clicked the "add" button... the details added are not shown... and even click "refresh" on IE wont help... all i got to do to get the newly added details shown is to close the current IE and re-request the page in a new IE... then all the pushpins(including the last pushpin added) can be shown... y is this problem occuring? am i doing anything wrong??Thanks,Any chance you can post the code so I can see if you are doing anything wrong?

Thanks for your fast reply...well... here's my code:

to load the map:

1 var map = null;2 var layerid = 1;34 function AddMyLayer()5 {6 var veLayerSpec = new VELayerSpecification();7 veLayerSpec.Type = VELayerType.GeoRSS;8 veLayerSpec.ID = layerid;9 veLayerSpec.LayerSource = 'Location.xml';10 veLayerSpec.Method = 'get';11 map.AddLayer(veLayerSpec);12 }
to add pushpin and get the position:
1 function AddPin()2 {3 var pin = new VEPushpin(4 pinID,5 map.GetCenter(),6 null,7 null,8 null9 );10 map.AddPushpin(pin);1112 if (pinID != 1)13 {14 var intpin = pinID - 1;15 map.DeletePushpin(intpin);16 }1718 document.getElementById('<%=lblPosition.ClientID%>').innerText = map.GetCenter();19 pinID++;20 }
asp.net code to store position and details to XML
1Protected Sub btnAdd_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)2Dim xmldocAs New XmlDocument3 xmldoc.Load(Server.MapPath("Location.xml"))4Dim eleItemAs XmlElement = xmldoc.CreateElement("item")5Dim eleTitleAs XmlElement = xmldoc.CreateElement("title")6Dim textTitleAs XmlText = xmldoc.CreateTextNode(txtName.Text)7Dim eleBlogAs XmlElement = xmldoc.CreateElement("link")8Dim textBlogAs XmlText = xmldoc.CreateTextNode(txtBlog.Text)9Dim elePositionAs XmlElement = xmldoc.CreateNode(XmlNodeType.Element,"georss","point","http://www.georss.org/georss")10Dim strPositionAs String = Request.Form("lblPosition") // to get position11Dim textPositionAs XmlText = xmldoc.CreateTextNode(strPosition)12Dim eleDescAs XmlElement = xmldoc.CreateElement("description")13Dim textDescAs XmlText = xmldoc.CreateTextNode(txtDesc.Text)1415 eleItem.AppendChild(eleTitle)16 eleTitle.AppendChild(textTitle)17 eleItem.AppendChild(eleBlog)18 eleBlog.AppendChild(textBlog)19 eleItem.AppendChild(elePosition)20 elePosition.AppendChild(textPosition)21 eleItem.AppendChild(eleDesc)22 eleDesc.AppendChild(textDesc)2324Dim rootAs XmlElement = xmldoc.Item("feed")25 root.AppendChild(eleItem)2627 xmldoc.Save(Server.MapPath("Location.xml"))2829 Response.Redirect("Map.aspx?Session=" + DateTime.Now.Millisecond.ToString + DateTime.Now.Second.ToString + DateTime.Now.Minute.ToString)3031End Sub
so what do you think? is that the XML is being cache by Virtual Earth? so even the XML is updated... but VE is still refering to the cache data?
thanks... 

Actually I do not see anything wrong as far as I can tell. What do you get on this line?:
document.getElementById('').innerText = map.GetCenter();My only guess is you don't get the right Client ID? Otherwise I'm lost sorry

document.getElementById('').innerText = map.GetCenter();
this line is to get the position of the pushpin to be stored in the XML file...

actually as you said... the code has no problem and is working fine... it can add pushpin on the map... and after clicking "Add" button... all the information such as Name, position etc. can be appended to the XML file...

but now the problem is... even all the information are appended correctly... but the appended information cannot be shown...

let say i've one set of information in my XML file... then when the first time i start my page... the pushpin can be shown on the map... then i add another pushpin... and click "Add"... the page refreshes... appending the XML file... but the map(or the pushpin layer) is not updated...

i have to close my IE and restart it to get my second pushpin to be shown... refreshing wont help... neither does CTRL + F5... that is the only problem which i think is VE's problem... haha...

any clue? haha...

Monday, March 26, 2012

Visual Studio 2005 WebApplication

What do I have to do to get the toolkit to work with a WebApplication Project in vs2005?
(I can't use WebSite project due to company guidelines)

I've added the httpHandlers and httpModules to web.config since I got clientscript errors. (scriptResource.axd could not be found).
This made some controls work, but not all. I still get some clientside errors.

Regards,
Jonas

Hi Jonas,

Just make sure that you have all the configuration settings related to the MS AJAX in the Web.config file of your WAP. You can copy settings from the sample config file in the AJAX installation folder.

HTH,

Vivek


Hi,

I had tried that before posting, but couldn't get it to work. However it works now (strange).

Thanks!

Visual Studio doesnt recognize(see) ATLAS from LAN!

When I try to open a website from server(LAN) I get following error within VS 2005:

Error 1 Element 'ScriptManager' is not a known element. This can occur if there is a compilation error in the Web site. ...

but the site works properly anyway... This error just annoys me, I can't see any Intellisence code for atlas components...

I have installed VS on server and installed Atlas components there too. VS shows Atlas tags properly when I launch VS from server, but doesn't do that when I try to open the same project from another computer.

The other computer has installed VS 2005 too...

Can anyone answer how to solve this?

hello.

i think this has been reported here...if i'm not mistaken, it only works without any problems when you open a local project.

VS 2005 IDE now unstable and crashing

I recently installed AJAX and the control toolkit, setup a sample website and it worked very slick. I have an existing app written in VB.net in VS 2005 that i am integrating the AJAX toolkit, specifically the dropdownshadow extender, scriptmanager and updatepanel, having copied the needed configuration into my web.config from the small app i wrote.

The problem is my environment is now extremenly unstable and crashes whenever i try to change a property of a control within the update panel or on any page containing an ajax control. Simply clicking on a textbox within the AJAX control will randomly cause an error screen i have never seen before saying Visual Studio has encountered an error and must restart.

Once the crash happens i cannot switch to design view as it says no AJAX tags are recognized, yet if i compile and run it works fine, not much help if i cannot design tho. I strip the tags out in code view and i am off again until the next crash.

After some crashes i try to drag an AJAX control onto a page and i get an 'Error: control could not be created' , control is not recognized. I have to reboot my system to get it to work.

I installed SP1 Beta and the problem still persists. This is very frustrating as the controls are working great other than when they crash my IDE. I will attach a screenshot if needed once i get in front of my dev station.

Hopefully someone has had this problem already.

Cheers!! And great work so far!!

I have never seen that, but can be a bug fixed in the new SP1 for VS2005http://alpascual.com/blog/al/archive/2006/12/15/Visual-Studio-2005-Service-Pack-1-has-been-released.aspx

See if installing it fixes your problems


This happens to me much more often as well after installing AJAX.

Sorry been away for a while, i installed SP1 but still unstable. I also constantly get

Error 182 Element 'ScriptManager' is not a known element. This can occur if there is a compilation error in the Web site.

It does not occur everytime but when it does i cannot change to design view. The site still runs fine but it is frustrating that i have to reboot or wait for the 'magic' in the air to sort the problem out. I have seen this in many forums but no one ever has an answer yet.


VS2005 often crashes when I try to shut it down with SP1 and SP1 for Vista. I get memory corrupt errors and it can't recognize the ASP.NET Ajax tags most of the time. I am running Vista x64 RC1 though so some problems could be related to that...

Want To create Accordion Script Like Yahoo

Hello Everyone,

I m developing a website in Asp.Net 2.0 with AjaxControlToolkit.I want Buttons To Appear and functional like yahoo Home page..

Any Help Is Appriciated.

Nitin

Which buttons on the "yahoo home page" are you talking about exactly? There are a lot.

I'm not seeing any accordions there, I am however seing some tab controls... but maybe I'm just blind... can you be a little more specific please?

Regards


Hi Nitin,

I suspect that you are saying the Buttons Like "Mail, Messenager,Radio etc". Based on my experience, you should better use TabContainer instead of Accordion.

Best regards,

Jonathan

Saturday, March 24, 2012

Watermark issue

Hi all,

I just installed Atlas and tried to make a text box with watermark. I select new Atlas website, add a textbox and a TextBoxWatermarkExtender. When I go to properties of the textbox and click the + before TextBoxWatermarkExtender nothing happenes. The + disapears and I don't get the css and text option. I use Visual Studio 2005 and have no IIS installed. Someone has had this issue before?

Regards,

Stijn

Nobody had this before? This seems to be a bug...
The problem and its resolution are discussed in this thread:http://forums.asp.net/thread/1359451.aspx

Watermark text

I created a practice atlas website, put a textbox on the form, dragged the script manager and watermark control to the form. Went to the properties of the textbox and the watermark referance was there with a plus sign. Clicked on the + sign and nothing was there, I could not insert any text. What am I missing? Thank you.I got it working locally but receive this error on the remote server.

Unknown server tag 'atlas:ScriptManager'.
It seems like maybe the remote server's not seeing the Atlas DLL as registered? Maybe check that there's an @.Register for it or a corresponding entry for it in the web.config on that machine.

Way to hold state of collapsible panel?

I've created a website application with a MasterPage that has an Accordion side-menu contained in a Collapsible Panel. It works fine, however, I need a way to hold the state of these controls when the user is redirected to another page.

So, if they have the side-menu collapsed and click a link to another page, when the new page is displayed, the side-menu should remained collapsed...is there anyway to do this? Basically, I just need to set some Session Variables to hold the state whenever the user manipulates the side-menu...

You could probably do it in viewstate? I don't have time to test it out right now, I'll try to get back to this later if nobody else has answered. Basically after you open a collapsible panel you could set something like viewstate("thiscontrolisCollapsed")=false and then on the page load you could do something like

if viewstate("isCollapsed")=false then

' code to open panel

end if

just off the top of my head. Sorry I can't be more technical with it, I'm getting ready to walk out the door and thought I'd throw this out as a suggestion.


Thanks, but the problem is actually being able to hold the state of the collapsible panel on the server side. All the collapsing and expanding is handled in client side javascript, and I'd need to somehow run some server-side code to hold the state after the client script has expanded or collapsed the panel.

I was thinking I need to fire off a client side call-back, but I can't figure out how to trigger it when the collapsible panel is expanded or collapsed...


Ok, I've figured out how to accomplish this. I already had an image that was the ExpandControlID and CollapseControlID, that the user clicks on to expand or collapse the panel. So I simply added an onclick attribute to that image which calls a javascript that initiates a client side call-back, where I pass the Collapsed status of the panel to the server and set a session variable. My code is below:

<script type="text/javascript" >
function holdSideMenuState(){
holdSideMenuStateInSession(!$find("SideMenuBehavior").get_Collapsed());
}

function sessionNowHoldsSideMenuState(isSideMenuCollapsed, context){
alert(isSideMenuCollapsed);
}
</script>
<table border="0" cellpadding="0" cellspacing="0" class="SideMenu">
<tr>
<td class="SideMenuExpandCollapse" valign="top">
<asp:Image ID="imgExpandCollapse" runat="Server" ImageUrl="~/images/collapse.jpg" CssClass="ExpandCollapseImage" />
</td>
<td>
<asp:Panel ID="pnlSideMenu" runat="Server">
Side Menu Content goes here....
</asp:Panel>
</td>
</tr>
</table
<ajaxToolkit:CollapsiblePanelExtender ID="cpeSideMenu" runat="server"
TargetControlID="pnlSideMenu"
CollapsedSize="0"
Collapsed="False"
ExpandControlID="imgExpandCollapse"
CollapseControlID="imgExpandCollapse"
AutoCollapse="False"
AutoExpand="False"
ScrollContents="False"
ImageControlID="imgExpandCollapse"
ExpandedImage="~/images/collapse.jpg"
CollapsedImage="~/images/expand.jpg"
ExpandDirection="Horizontal"
BehaviorID="SideMenuBehavior">
</ajaxToolkit:CollapsiblePanelExtender>


protected void Page_Load(object sender, EventArgs e)
{
string callBackReference = Page.ClientScript.GetCallbackEventReference(this,"isSideMenuCollapsed","sessionNowHoldsSideMenuState","context");
string callBackScript ="function holdSideMenuStateInSession(isSideMenuCollapsed, context){" + callBackReference +"}";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"holdSideMenuStateInSession", callBackScript,true);

imgExpandCollapse.Attributes["onclick"] +="holdSideMenuState();";

if (!IsPostBack)
{
if (Session["IsSideMenuCollapsed"] ==null) Session["IsSideMenuCollapsed"] =false;

cpeMenu.Collapsed = Convert.ToBoolean(Session["IsSideMenuCollapsed"]);
}
}

public void RaiseCallbackEvent(string isSideMenuCollapsed)
{
Session["IsSideMenuCollapsed"] = isSideMenuCollapsed;
}

public string GetCallbackResult()
{
return Session["IsSideMenuCollapsed"].ToString();
}


I have some more work to do because in my real code, I actually have an Accordion inside the collapsible panel, and I need to hold the state of the accordion as well, but I'll save any questions I have with that for another thread...

Wednesday, March 21, 2012

web service call by javascript

In my AJAX enabled website, call web service by javascript.

Web Service:

<WebService(Namespace:="http://tempuri.org/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<ScriptService()> _Public Class SimpleServiceInherits System.Web.Services.WebService<WebMethod()> _Public Function Addup(ByRef int1As Integer,ByRef int2As Integer)As Booleanint1 = int1 + int2Return TrueEnd FunctionEnd Class

Javascript:

var num1=1, num2=2;function Button1_onclick() {HangmanService.Addup(num1, num2, OnComplete);}function OnComplete(ret){if (ret == true){alert(num1);// should popup "3"}}

Actually, I got error of "System.InvalidOperationException -- Can't convert object of type "System.Int32" to type "System.Int32&" instead of "3". So do I have to get number from return value?

Hi,

the reference to num1 on server side has nothing to do with the reference to num1 on client side, they are two separate variables. Therefore Addup must return a number.


Try this,
 
<WebService(Namespace:="http://tempuri.org/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<ScriptService()> _Public Class SimpleServiceInherits System.Web.Services.WebService<WebMethod()> _Public Function Addup(ByRef int1As Integer,ByRef int2As Integer)As Stringint1 = int1 + int2Return int1.toString()End FunctionEnd Class

Javascript:

var num1=1, num2=2;function Button1_onclick() {HangmanService.Addup(num1, num2, OnComplete);}function OnComplete(result){alert(result); // should popup "3"}
WS

Thank you guys' reply.

The problem is not about return value but javascript even can't call the web method. Maybe in javascript a variable can't be reference parameter.


Ah, gotcha,

It's a little bit odd how you call your webservice function. Should it be ...

SimpleService.Addup(num1, num2, OnComplete); ......???
WS

I believe you should return the number in the return value if it's possible.
AJAX serializes input parameters and return values. I think that using ByRef is not going to work.
If you need to get those two values back (bool and int), you should consider returning a different type.

Hope this helps,

MaĆ­ra


Thanks for your reply. I just wanna know if it works. Anyway, I know it.