MS SQL : Cannot Connect to Database After Move

When moving databases from one sever to another, sometimes the users can become locked out. What I mean by this is, the user technically is in the Security>Users folder with all of the correct permissions like they should, but they cannot connect to the server, or they cannot connect to the database itself.

The solution to this is to delete the user, and remake it again.

Advertisements

ASP.NET Specific Error Message Fixes

The files ‘MyScripts.js’ and ‘CodeBehind.cs’ use a different language, which is not allowed since they need to be compiled together.

This error occurred when I put a JavaScript file in my App_Code folder. Simply move it out of that folder.

Both DataSource and DataSourceID are defined on ‘(id)’. Remove one definition.

This is an odd error message that usually means that you are binding a control twice to a datasource. However, if you are binding your control to an object (datatable, for example), that that object is empty and contains no data. Populate your data object and the error message will go away.

 

(I’ll post more as I find them…)

ASP.NET Apps : Migrating IIS 6 to IIS 7 ; IIS 7 Errors

Migrating from IIS 6 to IIS 7 is a pain in the rear.

From first hand experience, let me tell you, you want to start with a new web.config generated by Visual Studio. There’s a few new sections in there like runtime, and system.webServer. The latter being specifically for IIS7.

I experienced a plethoria of issues in this migration process with my ASP.NET applications. The primary symptoms of IIS 6 to IIS 7 migration troubles are pages that work on some servers but not others, in some browsers but not others, and mysteriously work one day but not another. The primary culprit is usually the web.config.

Here are some issues I discovered and how to fix them.

httpHandlers and httpModules

Server Error in Application “”
Error Summary: HTTP Error 500.22 – Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.

Most Likely Causes: This application defines configuration in the system.web/httpModules section.
Most Likely Causes: This application defines configuration in the system.web/httpHandlers section.

FIX: IIS7 does not seem to like httpModules and httpHandlers. In actuallity, it does like them, very much so, however, they are now renamed to ‘modules’ and ‘handlers’ respectively and belong in the system.webServer. You can delete the sections, but then you will probably encounter errors with Validation controls not being called automatically upon postbacks – and you can work around that by manually calling Page.Validate() and if (!Page.IsValid){ return } .

Clientside Javascript (Custom Validators):

I was manually entering “(document.findbyid(‘$ctx200$section1$uxTextbox3’) …” and this had problems with IIS7 that were fine under IIS6. Try using uxTextbox.ClientID instead of hardcoding IDs.

Assemblies Errors

Could not load file or assembly ‘System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

FIX: The new IIS7 web.config section runtime includes some new ways to use assemblies that include an ‘oldversion’ tag, they look like this:

    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
          <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
          <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
      </assemblyBinding>
    </runtime>

OR, you can do it the hard way: going to START > RUN > assembly And adding the correct version and public key tokens. If it is already correct and you still get errors, try changing the string to all upper or all lower case letters.

Forms Authentication Problems

SYMPTOMS : The terrible white screen of IE death – “Internet Explorer cannot display this webpage”, no error messages. Inside your Event Log, there will probably be 302 Error messages. Some other symptoms include the page taking over five minutes to load in IE and the IE process taking upwards of 1,800,000 of memory and substantially high CPU from your server (mine was at 55%!).

FIX: The new IIS7 targeted web.config has sections that fix this.

Javascript ScriptHandler/ScriptManager Errors

‘Sys’ is undefined

SYMPTOMS: Custom Javascript and/or CustomValidator can start acting funny or skip validation. Sometimes a page works on one server but not another, in IE but not Firefox, etc, etc.

This can occur when the  web.config does not contain all of the sections for AJAX. Scrutinize your web.config line by line and make sure all of the AJAX sections are included. In my case, I was missing some sections inside of the system.webServer section, and after re-addition, everything works beautifully again.

 

Related Posts: web.config Hell: Managing Multiple or Mixed Environment web.config’s

 

Contribute Troubleshooting Bible

Macromedia/Adobe Contribute : Problems & Fixes

Last Updated : 09/29/2010

Contribute is a problematic and headachey program. Here are my experiences on the matter and how to fix them.

Contents

  • Installation, Re-Installation, Errors
  • Program Use Troubleshooting
  • Q&A
  • Tips & Advice

    Installation, Re-Installation, Errors

    Disk Not Found when Installing
    For Contribute 3 and 4, when installing via CD media, there is a problem with the disc.  To advoid  ‘disk not found’ errors, insert the disk, install, run for the first time, close Contribute, eject disk.

    Reinstallation Problems for Contribute 3
    For any odd errors, delete/finish any unfinished drafts, and simply do a reinstall of Contribute. Be sure to delete the program directory and any lingering files for a very clean re-install.

    Reinstallation Problems for Contribute 4
    Same as Reinstallation for Contribute 3. Somewhere, somehow, Contribute stores the connection settings on its host computer. Searching the registry, program directory, temp user files and preferences have all turned up negative on removing these preferences.

    Installation Problems for CS 4
    If the installer gives a general error message durring installation, it’s quite possible that you have another version of Macromedia Contribue or CS on your computer. Uninstall them all. If it won’t let you uninstall them, be sure all drafts are delelted inside the program and try again. Once you’ve gotten the old programs gone, you can optionally run a cleaner by Adobe (here)

    Missing DLL Errors for Contribute 4
    Update/upgrade Internet Explorer to the most recent version, these errors may have been caused by a recent Windows Update writing to windows-common DLLs.

    Program Use Troubleshooting

    Disk Not Found Error on Windows 7:
    For Windows 7 ‘disk not found’ errors, uninstall and reinstall the latest version of Contribute (Adobe Contribute CS4, at the moment).

    Program Use Troubleshooting

    Cannot Delete Table:
    All tables in Contribute do that. But you can get rid of it by CTRL-X, or cutting it.

    Cannot Insert Image:
    This can happen in several situations. When the image dimensions are so large Contribute doesn’t know what to do with it, Contribute will silently decline your request. When the image file size is larger than the limits set in the Administrator section for that website, it will tell you that the image is too large.

    Image Bug: Poor, Degrading Image Quality
    If you insert an image for the first time in Contribute and then begin to play with it, Contribute will store this image in it’s own files. All modifications to the image are quite terrible and nearly irreversible; they are applied to Contribute’s image file directly, while your original image is safe. Workaround: Insert your image, publish, and then proceed to work with the image.

    Browser Does Not Refresh:
    This problem is encountered when you press the Refresh button and changes are not applied. The problem has to do with Contribute’s internal caching. I have not found a solution to this other than restarting Contribute or simply using an alternative browser than Contribute’s built in Internet Explorer.

    Cannot Click ‘Edit Page’ (Greyed Out):
    This can occur in several scenarios: You are not connected to the website, a missing/added ‘www’ than the website you are connected to, the server is taking too long to respond, or the server has a lock (.LCK) file for this page – simply delete it to edit the page (see next below).

    When I Click ‘Edit Page’ Nothing Happens (For a Particular Page):
    This problem can occur when page drafts are present. Delete or publish all of them and try to edit the particular page again.

    Page is Locked:
    A “locking” mechanism exists to prevent multiple people from working on the same page and thus stepping on eachother’s toes. More often than not, this mechanism will simply step on yours instead. When a page is locked with no name beside it, it’s gotten stuck. Or, when the page does say a name, but it is known to be untrue, it’s also gotten stuck. The solution is to simply remove the lock. Go onto your server and search for a file that looks like <page>.<extension>.LCK , and delete it.

    When Click ‘Edit Page’, Page is Blank (But Renders O.K. In Browser):
    The usual suspect for this is bad/mangled HTML code somewhere on the page. I’ve even encountered this because of a missing </table> tag.  Try putting the page through a HTML Validator. If still no luck and you are using a template, check that the Dreamweaver/Contribute Template/Instance comments are correct. Templates have tags:

    <!-- TemplateBeginEditable name="sectionName" -->
    <!-- TemplateEndEditable  -->
    

    And child pages have these tags:

    <!-- InstanceBegin template="TemplateFile.dwt" codeOutsideHTMLIsLocked="false/true" -->
    <!-- InstanceBeginEditable name="sectionName" -->
    <!-- InstanceEndEditable -->
    <!-- InstanceEnd -->
    

    Template pages may only have template tags, and child pages only instance tags.

    Page looks different in Contribute than browser?
    You will always be fighting this issue. Give your normal browser the final word in this battle. If you use an ASP.NET master page, it is perfectly normal for the child pages to look completely different or plain. Often scripted/coded objects will be represented in their simplest forms or even omitted altogether.

    Q&A

    Can I delete all of this metadata?

    It is safe to delete _baks, _mm, _mmServerScripts, _notes, _private, _vti_log, _vti_cnf in all of their locations and nested directories. Note that deleting _baks will remove any backups users may have  made of their pages. Folders looking like TMPksdf87923ks893 are created by Contribute and contain drafts that users are working on. If the directory is empty, it is safe to delete, as Contribute once held works-in-progress there for a particular user, but not anymore.

    Can I delete all of this Javascript?

    Yes, you can. IMO it offers no performance boosts or performs any useful function of any kind. The Javascript typically is prefixed with MM_ and looks like this :

    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    
    function MM_showHideLayers() { //v6.0
      var i,p,v,obj,args=MM_showHideLayers.arguments;
      for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
        if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
        obj.visibility=v; }
    }
    
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    
    function MM_openBrWindow(theURL,winName,features) { //v2.0
      window.open(theURL,winName,features);
    }
    //-->
    </script>
    

    Don’t forget to take out the references Macromedia also put in the (Reduce the blurb below to say simply ‘<body>’) :

    <body onLoad="MM_preloadImages('MM_showHideLayers('topdisnavab','','hide','topdisnavbl','','show','topdisnavco','','hide','topdisnavac','','hide','topdisnavst','','hide','topdisnavre','','hide','topdisnavad','','hide','topdisnavts','','hide','topdisnavgs','','hide')">
    

    Tips & Advice

    Editing Images:
    Contribute is not an image editor. You can try to use whatever built-in functions there are to accomplish the look you want, but your best bet is to use a 3rd party (or OS-included) image editor.

    Templates:
    Macromedia Dreamweaver has a big problem with templates – it does not “use” a template, it copies the template code as a new file and then inserts content into it. Duplicating, creating, and editing templates is a pain. If at all possible, advoid editing your templates, especially for large sites, Dreamweaver will break them.
    Make use of the InstanceBeginEditable and InstanceEndEditable tags.

    WWW Problems: Reinstallation/Connection Tip/Hack
    http://www.mysite.com and http://mysite.com can be classified as two different Contribute Website Connections; use to your advantage – when one fails, you have another to use.

    Should I Install the Toolbars?
    No. They are worthless, and getting rid of them completely once installed is a pain, they tend to pop back on, especially with MS Office.

    Adobe Contribute 3 & CS 4 Differences
    Adobe Contribute CS 4 is the only Contribute so far that supports Windows 7. It now features a slower installer, new sleeker dark-gray theme, and same old featuresbugs. The installer works like a slacker does homework – it does nothing untill the very last second. You will notice Adobe prompting you to install of it’s latest bloatware. All you need is Contribute and any supporting files (listed as Contribute subitems).
    IMPORTANT NOTE : The second you administrate one of your websites in Adobe CS 4 (or possibly even connect as administrator role), all other contributors/editors under that website must upgrade to Adobe CS 4.

    Got any other problems? (Feedback)

    If you have any problems not covered here, reply back and I’ll add it to my blog.