Migration: ASP.NET 1.1 to ASP.NET 2.0, broken postback - asp.net

We just recently migrated our web application from .NET 1.1 to .NET 2.0.
The web application was originally written in .NET 1.1 using Visual Studio 2003. To migrate it, we converted the solutions to VS2005.
Aside from some minor problems like RESX incompatibility and broken Calendar Controls, the Web Application worked.
However, we just tested it today and some postback functions are suddenly broken. In particular, the "File Browser" one. When the user clicks on the browse button, a new window will open (a custom page) that will allow him to browse for the file, the PATH will then be passed to the parent page then saved on a textbox, then it will postback to do some validation on the path. However, on POSTBACK, the path that was stored in a textbox is now gone and was replaced by the "default" path.
Is there something that we should watch out for in migrating from 1.1 to 2.0 that can break postbacks?
Thanks! :)

This is a design issue in ASP.NET 2.0.
My textbox was set to readonly. This behaviour is by design in ASP.NET 2.0 and it has been designed with the idea that a ReadOnly TextBox shouldnt be modified in the client side by a malicious code.
Workaround:
Instead of setting the readonly property during design time, you should set in during runtime.
TextBox1.Attributes.Add("readonly", "readonly");
References:
http://www.dotnetspider.com/resources/3120-ASP-NET--TextBox-Ready-Only-losing-client-side-changes-values-across-postback.aspx
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.readonly.aspx

Related

How can I debug both classic ASP and ASP.NET code in the same debugger session?

I have a web app which is a mix of classic ASP and ASP.NET code, and I'd like to use the debugger. However it seems from looking at the Modules window in Visual Studio that only the ASP code happens to be available to the debugger at the moment; I get "the breakpoint will not be hit, no symbols have been loaded for this document" when I set a breakpoint in the ASP.NET code. How do I make both the ASP and ASP.NET code available? Or failing that, how do I switch between the two? Earlier I was able to debug the ASP.NET code but not the ASP code; it seems to be switching back and forth somehow but I don't know how to force it to do so...
According to this question it's not possible to debug both ASP and ASP.NET in the same session, but that was 10 years ago so maybe something has changed?

Issue while using WinForm user Control in asp.net MVC applicaton

I need to use a WinForm User Control in an ASP.Net MVC4 application.
The control has been embedded using the object tag and classid attribute, but upon viewing the view in browser, only a blank frame is visible, without any cross-sign on top-left corner of frame. The viewing browser is on a machine with .Net Framework 4.5. Similar issue was faced in an ASP.Net application but same was rectified using Registry setting (EnableIEHosting = 1).
Kindly suggest.
Thanks.
Gitika
WinForms user controls are not intended to be used from an ASP.NET (MVC or not) application.
As you should already knows, ASP.NET generate HTML codes that will be sent to the browser when requested. The browser can run on a multitude of operating systems (OS). WinForms user controls essentially only run Under Microsoft Windows.
The second thing to know is that a browser run in a restricted environment and as such as a very limited access to the computer and its OS.
Since you are using ASP.NET MVC, then you should create a partial view that is similar to your user control if this is what you want. Also, another thing to know is that any logic behing your control need to be converted to JavaScript or jQuery. This is what browsers understand.

How can I access "Visual Studio Conversion Wizard" for a WebSite?

I'm using this article to convert my ASP.NET 2.0 web application to an ASP.NET 4.0 application.
However, the article states that I will be prompted to change to .NET 4.0 when I open up my project/website.
As I've previously declined this dialog I'm not longer being prompted.
I've read this question which states I should click on the Properties tab of my solution, but I only have "Properties Window". Perhaps this is just for Projects/
How can I get the conversion wizard to reappear for my WebSite?
I haven't been able to get the Conversion Wizard to reappear, but I have been able to convert to .NET 4.0 by:
Right Clicking on my website
Selecting Property Pages
Then go to Build tab
Change Target Framework
This made all the changes to my web.config automatically just like the conversion wizard would.

Windows Forms message box doesn't work in published ASP.Net application

We're developing .Net Application using asp.net and C# and .Net Framework 3.5.
We are using windows form message box in a .Net application.
This windows form works great on the debug mode but once we publish the application this message box won’t work.
We are referencing System.Windows.Form.dll in order to use the message box features.
Kindly advice if we need to register this DLL or follow some configuration steps in order to solve this problem.
Thank in advanced,
Jad
Don't use MessageBox in a web application. It will show up on the server console, there's nobody around to click the OK button. I assume that ASP.NET has some counter-measures against it, given that it is such a serious denial-of-service attack.
If you are using unreferenced classes a project/solution is usually not even compiled.
So probably the problem is in another place. Are you sure that the code that should display the MessageBox is executed?
EDIT: When you develop web applications (ASP.NET), as described by you in comments, you cannot use Winforms MessageBox.
Try showing it with javascript, if you really need it
Response.Write("<script>alert('This a message')</script>");

Type or namespace not found for user control

Tonight I copied an ASP 2.0 web site onto a client's machine, and lo! It did not work. It works perfectly on mine, under built in debugger and under IIS 7, and two weeks ago, it worked perfectly on his machine under IIS 6.
The only changes I have made are upgrading telerik RadGrid etc. to Q1 2009, and some refactoring. The application fails on two entry point web forms. Both have a RadGrid, which uses a User Control for its editing pop-up. Both forms fail to compile, with a 'Type or namespace JobEditControl not found" error, on a line like this:
var editControl = e.Item.FindControl(GridEditFormItem.EditFormUserControlID) as JobEditControl;
The control is not referenced in the markup, as it never appears on there, and as I understand it, it should be compiled into the same default namespace as the page is compiled into when first hot.
The machine is still serving user controls properly, i.e. the .ascx handler appears healthy, and a quick test page containing a quick test control I added worked fine.
Another developer was busy on the machine before me, also installing an ASP.NET application, but I can't think of anything he would have changed. Even being my competition...
Check if the web.config has a reference to the current version of the telerik's controls.

Resources