ASP.NET is not displaying changes I do to code - c#

In my web app I have a lot of gridviews and so on. Now I was trying to change some data format in the gridview, and the changes did not take effect when i debugged, either in Chrome nor Internet Explorer, it kept showing the same gridview as before. I tried to change the SQL data I was providing to it, and it actually changed, so the problem is when I'm altering in my web project.
Wondering what this could be, I did another test by removing the function that triggered when a button is pressed. When I debugged not only I did not get the error that usually comes with not assigning anything to a OnButtonClick but also when I pressed the button it did what it was doing before i removed the function.
Did this already happen to any of you?
Edit1. Now I tried to create an empty webform and when I debugged I get this error:
Error of analyzer
Description: Error parsing a resource required to make this request. See the
specific analysis error details below and modify your source file appropriately .

Are you hosting in IIS or debugging with Visual Studio's inbuilt server?
Try cleaning and rebuilding your code, then clearing your browser cache

Try deleting cache and cookies from (both of) your browsers.
Sometimes this gives problems when you are debugging because you will keep seeing previous parts of your current app.

Related

Visual Studio ASP.NET aspx page empty lines bug

I am creating an ASP.NET app in Visual Studio 2013 which has about 12 pages. However, in one of the page's aspx page in VS, when I save or auto format the page it will insert/create hundreds of empty lines. Most recently it has managed to create over 300,000 lines.
I keep deleting these lines, which is quite time consuming because the lines are spread throughout the code, but they just keep getting inserted.
This bug does not occur on any other page, the only thing that is different about this page is that it uses a DevExpress ASPxPageControl, but I'm not sure how that would have anything to do with it.
I have tried deleting the page and copying the code over to a new page, but the same bug keeps occuring. Does anybody have any idea how I would go about fixing this bug?
UPDATE: I have created another page which also uses the DevExpress ASPxPageControl and it has started to happen on this as well. So I am assuming that this issue has to do with the control.
UPDATE 19/09: This issue no longer happens, but I have no idea why or how it has been fixed.
UPDATE 06/12: The issue appears to happen only when design view is opened. If I only ever look at the source view, it never happens.
There is a question that looks like the same problem you have.
Try checking if you are missing any closing tags.

Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in a correct format

Hi I am getting the error
"Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in a correct format."
When pressing a delete button. But this error comes only in one web server. In other server it works fine. Again when locally running the application, there is no error but it will not firing the delete action. Any Idea??
Found elsewhere the suggestion to use an Image inside a Linkbutton.
Works well. ImageButtons inside Gridviews especially within update panels were always a pain.
http://forums.asp.net/t/1823287.aspx/2/10
Re: ImageButtons not working in IE10
Dec 05, 2012 04:38 PM|LINK
I couldn't get any of the above example to work for me, but I have an Image Button in a repeater within an update panel. Anyway, I just replaced the Image Button with a Link Button wrapping an Image and everything is working again.
Yes... This issue was solved by updating the .net framework to 4.5. The issue was with the framework with IE 10. Please check your server .net framework and Your local PC as well.
Just simply update the framework. I couldn't find any other solutions rather than this. :)
if the delete image button and you don't need to install the .Net framework 4.5. All the time we are not able to change the framework versions. If we have window server 2003 r2 then we can't install the .Net framework 4.5. So in this case we can change the Image button to Link button. Here is the same source for link button to show as like image button in the asp.net
<asp:LinkButton ID="deleterow" runat="server"
CommandArgument='<%#DataBinder.Eval(Container.DataItem,"Id")+","+DataBinder.Eval(Container.DataItem,"Facultykey") %>'
OnCommand="DeleteFaculty"
Visible='<%# EnableControls(DataBinder.Eval(Container.DataItem , "IsFacultyConfirmed"),2,DataBinder.Eval(Container.DataItem , "AFTId"),DataBinder.Eval(Container.DataItem , "FacultyKey"))%>' >
<asp:Image ID="Delete"
ImageUrl="../App_Themes/Blue/images/buttons/delete.gif"
runat="server"/></asp:LinkButton>
Since i personally suffer having windows server 2003 R2 and unable to install the .Net framework 4.5 and it will helps to solve the issue without touching the server config.
Hope this helps
i know this is old question, but for people who will come here in future and read this, I will describe how I solved it.
My application was working for several years without problems and suddenly clients started to notice 'forewer waiting', page not refreshing because of above mentioned error (Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in a correct format.)
I had hard time to discover what was main problem because there was no error while debugging .cs code. After searching a lot I discovered that someone proposed to disable PartialRendering...
(you can do it in .cs by ScriptManager1.EnablePartialRendering = false;
or in page by adding EnablePartialRendering="false")
So I disabled it, and voila... finally while debugging, error appeared in one function, and executiuon stopped like before but with more description. Cool, now I know where is enemy :-)
It is interesting that it wasn't hit at all while EnablePartialRendering is true.
Now execution wasn't stopped in Code Behind too, but finally some more text in browser window, this is what I got:
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.FormatException: Input string was not in a correct format.
Source Error:
Line 1209: Array.ConvertAll<DataRow, double>(
Line 1210: dt.Select(),
Line 1211: delegate (DataRow row) { return Convert.ToDouble(row[columnName].ToString()); }
Line 1212: );
Line 1213: return GetMedianFromArray(values);
Problem was in Line: 1211

asp.net code-behind visible from browser?

Can someone see the code-behind of an .aspx website from a browser?
I have been told it is possible but i cant really find a way of doing it , viewing the page source only shows the presentation page..
So is there a way of doing it ? and how?
thank you
No, it is not possible to see the codebehind without physical or remote access to the server itself.
You could also in theory misconfigure the IIS server to display the source files, and that would cause them to be displayed, rather than compiled, but no idea why anyone would do that. IIS by default will not display them.
By default, IIS shows parts of your code (aspx or code-behind) when an exception occurs - along with the call stack of the exception. Any serious ASP.NET application hides this information from users by using specific error handlers to show the error information in another (often more user-friendly) format.
As others mentioned, it's not normally possible to see the code, as it's a server-side handler, compiled and run on the server, while client only sees the HTML output.

What could be causing different behaviour remotely on asp.net site

I have a site that I have developed in asp.net. On debugging the site now hosted using IIS7 I noticed a bug, I cannot reproduce this when I run it locally in vs, meaning I can't see the error. The bug occurs on the check box changed event of a devexpress check box. It connects to the database using devart.postgres sql component and linq. However, this is the same connection as anywhere else in the project. The same code works elsewhere in the project. The error I get is:
the requested name is valid, but no data of the requested type was found.
Part of my code is in an if statement that checks if a textbox is blank if so it does not run the code within the if statement, interestingly enough if the text box is blank the code runs, so it must be in the if statement? I commented out all of the code and tried again and it still would not run. Beginning to lost objectivity with this problem, hope you can help.
The error you have posted suggests that there is a problem resolving an address. For example, when you check that checkbox, something in your code tries to resolve a valid address, but the DNS server doesn't recognise it. Are you doing anything that would involve name resolution?
Can you share the code that causes this error?

Asks for AD credentials / "Connection Interrupted" on Postback

A lot of lead up:
I have a simple ASP .NET 3.5 data entry webform with a series of dropdown lists, text boxes, and text areas and user authentication is being handled by Active Directory.
The user enters a alphanumeric id, and clicks a button. The button's onclick() in the aspx.cs:
1. calls a stored procedure to determine if it a new record, or the existing data if it already exists
2. if the record exists, then pre-fills the form with the existing values.
There are three textboxes which have been extended to use ASP .NET AJAX AutoComplete (each contained in their own asp:UpdatePanel), which also postback successfully.
When the user is done entering the data, there is a single button to save the record, which:
1. calls a stored procedure, which either inserts or updates accordingly
2. clears the webform
3. displays a quick success message.
There have been over 4000 records inserted and updated through this form since it's launch. I now have a problem where there is ONE record that cannot be updated, it was inserted a month ago, through the same form, without issue.
In Internet Explorer (6, 7 and 8): When you click the save button, it asks for you to provide your domain username and password. Entering a valid username and password displays the "Internet Explorer cannot display the webpage" screen.
In Firefox 3: When you click the save button, it displays the "Connection interrupted" screen. Clicking the "Try Again" button does not change the results.
There are no entries in the logging that the application uses, the server's Event Log, nor for SQL Server 2005.
I have tried:
- on different computers, and it failed.
- with different users, and it failed.
- with numerous other records, and they update perfectly.
I have loaded the record into the test environment in two different manners:
1. copied and pasted directly from the production database to the test database
2. copied and pasted directly from the production webform to the test webform.
The issue does not happen in test or my local development system. Both production and test are running ASP .NET 3.5 SP1.
I even saved a copy of the production page which is failing and the test page which works as HTML and ran them through Total Commander's "Compare Files by Content" function, in the hopes that the differences would be highlighted in red to be nice and obvious. The only differences were in the areas auto-generated by .NET at runtime, and the occasional place where a dropdown's item list has more entries in production then in test.
I realize there is probably something wrong with the data that is causing the final postback to fail, but it appears to be failing before the postback even starts. I have looked through the record's data through viewing the source of the loaded aspx page and in the database in the hopes of finding a stray invisible character or a textarea that has too many characters that may be causing it to choke, but no luck.
A coworker suggested setting viewStateEncryptionMode="never" in the web.config and this has 'fixed' the problem, and the record can now be updated without error.
Unfortunately, I cannot provide the data that is causing the form to fail.
My question:
Does anyone have an idea why this happened in the first place or why setting viewStateEncryptionMode="never" fixed it? A better solution than setting the ViewStateEncryptMode to never would also be welcome.
Thanks!
First, and most important - besides .Net 3.5 SP1 - make sure you have the latest patches installed on the server (this should always be the first step).
Assuming the server is up to date, I'd start by checking the firewall and anti-virus software on your server (they should have logs). Anti-virus can block web sites that use suspicious code - like a known JavaScript exploit (I'll admit I tried that one. For science). It's possible a specific combination on the viewstate looks like suspicious code or file (seems weird, but possible).
Next you can check the IIS. Enable logging and see if you get any errors. Check if you have any isapi filters installed (these can be in several places - the 'Web Service Extensions' folder, or a tab on the web site's Properties, or one of its parents' Properties)

Categories

Resources