|
I think the ScriptManager also listens for events, so the ScriptManager thinks your event belongs to it, and can't find the handler. But I don't what the error message was, so I can be totally off base here.
This won't fix your problem, but should give you an idea of how to handle events with the script manager, where you can separate Javascript ajax from updatepanel ajax.
I wouldn't do a postback on textchanged, but instead use a button click
if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(AjaxEnd);
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(AjaxBegin);
}
You may want to learn more about __doPostBack, and get a clearer understanding of it.
I've never used it, or written code like your sample.
http://weblogs.asp.net/yousefjadallah/archive/2010/06/27/insure-that-dopostback-function-implemented-on-the-page.aspx[^]
|
|
|
|
|
Hi,
I don't know if here's a correct place to answer or not but We have developed an application using ASP.Net 2008 and SQLserver2008. When we published it into a host server it was working slowly. and when we published it to another host server it times out so often and works again without making any changes to anything.
Please let me know, what would you check to resolve such problem?
any idea is appreciated
|
|
|
|
|
I would try requesting a file like robots.txt, and see how long it takes to come across the wire. If it's slow, then perhaps your service provide has you on a fully loaded server, or they are low on bandwidth.
Try it a couple of times, because the web site might be in a idle state, and will take time to load the first time.
If it's really fast, then you need to dive deeper, and test pages that use the sql server.
Other than that, there be test software out there, that measures speed.
http://yourdomain.com/robots.txt
|
|
|
|
|
Are you hosting with a commercial service, or on in-house servers? In either case, the first thing I'd do is to enable logging on both IIS and SQL Server, then review the log files for clues to where the timeouts are occurring. If you're on your own servers, it's much easier, as many commercial hosts charge extra to gain access to the built-in log functions. If you're using an outside service, you may have to fight for access and pay an unreasonable fee for the privilege of viewing what costs them nothing to give you.
If this isn't an option available to you, you may have to modify the site code to monitor and report to you the time required to complete critical steps. A little creative scripting to generate a text file of calls to the SQL Server and return times might be useful for diagnosing the problem. Add a log.txt file to your site, add code to write timestamps to it for as many calls as you think might be contributing to the problem, and download the file periodically for review. Depending on the site structure and design, you might also be able to capture all error messages and log them to a file, if they aren't being displayed to you when an error occurs.
Of course, it may be that your hosting service sucks. It's unfortunate, but some really are substandard.
Will Rogers never met me.
|
|
|
|
|
Thank you Rojer for the comments.
I have full access to the host server (it is commercial) but the problem is that the time out occurs here and there. That is, it occurs, for instance, at stored procedure 1 now and then another time it runs the SP1 well and then occurs at SP2.
How can I be sure that the problem is from the host server? As I have to prove that to my boss
|
|
|
|
|
Beats me! Can you access the SQL Server logs on the server? Are you opening connections in your app but failing to close them as soon as you're done with an action? SQL Server is a resource hog, and it's critical to clean up after yourself often. Without a lot more information, this is an impossible problem to solve form a distance. Good luck!
Unfortunately, the universal law, "All things are simple for the one who doesn't have to do them" applies, and "I dunno" isn't going to convince the boss.
Will Rogers never met me.
|
|
|
|
|
I want to be able to debug a C# 2010 web form application that runs using the local iis server. I have my breakpoints set in the application, but the code never stops at those breakpoints. ( I want to do this type of debugging since the application is going to run under iis on a test server and then in production.)
When I run the web form 2010 application using cassini in the debug mode, all the break points are hit and the code runs with no problems.
Thus can you tell me what I need to do to be able to debug my web form app 2010 using the local iis server so that I can hit the breakpoints I have set to see what is wrong with the application?
|
|
|
|
|
You have to attach the debugger to the instance of
aspnet_wp.exe that is running.
Open the site in IE as normal and set all of your breakpoints and then, from the main menu, select 'Debug', 'Attach to Process'. Select 'aspnet_wp.exe' form the list and click the 'Attach' button at the bottom right of the dialog.
Navigate to the page you wish to debug and your breakpoints should start to get hit.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
How can I 'Open the site in IE as normal' normal? I run the code in cassini in the visual studio 2010 ide and hit f5.
|
|
|
|
|
Publish your website on IIS in ASP.NET page: http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx
1. webvidu asp.net to run in normal mode and programming Publish normal website
2. Publish test their IIS under ASP.NET on IIS website, follow the instructions above also normal
3. When put up IIS and web browser they type in localhost/asp shall be the following error:
XML Parsing Error: not well-formed
Location: http:
Line Number 1, Column 2:<%@ page theme="Default" language="C#" masterpagefile="~/MasterPage/MasterPage.master" autoeventwireup="true" inherits="webvidu._Default, App_Web_default.aspx.cdcab7d2" %>
-^
I do WinXPSP2 IIS on the operating system, and use vs.net2005 13.0.1 firefox browser
so please fix this bug? thanks
|
|
|
|
|
One possible reason: Check if correct .NET Framework is selected in IIS. For example, it might be set as v1.1 right now but v2.0 is needed.
|
|
|
|
|
I do not think NetFramework because my web host is the same machine.
|
|
|
|
|
So what? In your IIS you might have forgot to set the correct Framework version. Please check.
|
|
|
|
|
I've modified the above error, machine error follows:
Server Error in '/asp' Application.
Failed to access IIS metabase.
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.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
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:
[HostingEnvironmentException: Failed to access IIS metabase.]
System.Web.Configuration.MetabaseServerConfig.MapPathCaching(String siteID, VirtualPath path) +3492170
System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath.MapPath(String siteID, VirtualPath vpath) +9
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +163
System.Web.CachedPathData.GetConfigPathData(String configPath) +382
System.Web.CachedPathData.GetConfigPathData(String configPath) +243
System.Web.CachedPathData.GetApplicationPathData() +68
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +3385679
System.Web.Configuration.RuntimeConfig.GetLKGRuntimeConfig(VirtualPath path) +189
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
|
|
|
|
|
|
Hi,
when I start debuge a web solution, this message appear,even if solution was a empty web form,
what should I do...?
I use visual studio 2010 & windows 7.
modified 25-Jun-12 11:57am.
|
|
|
|
|
|
Thanks for guides... I read that, but that's not helpful…
Actually I reinstall windows at last, and before installing VS, I install IIS by all categories.
That's worked.
|
|
|
|
|
In a C# 2010 web form that uses a formview control, I am comparing 2 dictionary objects to see if their values are different, right before the actual change occurs in the database. The code is comparing the old dictionary value to the new dictionary value to see if the value has changed. If so an 'invalid' date field is being set.
However the problem is the values are actually the same. By stepping through the code, the application thinks the values are different. Can you tell me what is wrong with the code listed below:
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
if (e.NewValues["Cutoff_Date"] != e.OldValues["Cutoff_Date"])
{
e.NewValues["Invalid_Date"] = "Y";
}
}
|
|
|
|
|
First thing you should check is the whether formview is getting databound on each postback or only one first postback . because if it is getting databound on each postback then you will have to make it do that only on first load and not on each postback .
If that doesn't work then, My suggestion is that you handle the ItemDataBound event too. get the value in this event and save it somewhere (like session variable). then in this event get the new value and compare it with the one in in session variable.
Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.
|
|
|
|
|
When comparing text, you have to do a compare against the actual values of the text, and not the string representations held in e.NewValues and e.OldValues. That type of comparision is good for numbers, or short text such as "GOOD" or "BAD"
So text is really stored as a byte array like 37 80 68 70 45 49
Doing a String.Compare will examine the byte array of the strings, and give you an accurate result.
In your case, I don't what the values are, but NewValue != OldValue will not produce a consistent result.
If String.Compare(path, 0, "file:", 0, 5, True) = 0 Then
Return True
Else
Return False
End If
classy_dog wrote: However the problem is the values are actually the same. By stepping through the code, the application thinks the values are different.
You lost me here. You know the values are a match, but stepping through the code shows you different values.
I going to go with an inaccurate result being produced by your comparison
|
|
|
|
|
classy_dog wrote: By stepping through the code, the application thinks the values are different.
That's because you are comparing the values of the objects and not their content. You need to do a String.Compare() [^] to compare the string data; the == and != operators will merely tell you whether the two references point to the same or different objects.
[edit]
Well I was wrong as, according to MSDN[^] strings are a special case. I can only conclude that the dictionary is not returning string s in the sample you showed.
[/edit]
|
|
|
|
|
I knew you had to do a string.compare, and some of the details of it, but didn't think of his code as comparing objects, and not the actual value.
Nice Answer!, I even learned from it.
|
|
|
|
|
According to this[^] it looks like I was wrong. Time for a big slice of crow pie, followed by some C# testing.
[edit]
I suspect the dictionary that OP is using, does not return pure strings in the sample shown.
[/edit]
|
|
|
|
|
We got a little debate going on here in this rodeo cowboy
I read the reference you pointed to, and I must support your first argument regarding comparison operators and objects
Operator B for string b = string.Copy(a) returns false, but a and c returns true
string a = "hello";
string b = String.Copy(a);
string c = "hello";
Console.WriteLine(a == b);
Console.WriteLine((object)a == (object)b);
Console.WriteLine((object)a == (object)c);
Anwsers:
True
False
True
[edit]
The op took a shortcut by using an operator against the objects, and failed to create 2 new buffers to store the actual values he needs to string compare.
I threw a little c++ lingo in there.
|
|
|
|