A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: web.config editor

  1. #1
    Member
    Join Date
    Mar 2001
    Posts
    78

    web.config editor

    I'm loading web.config in and parsing it as an XML file so that I can change the executiontimeout and maxRequestLength settings (fileupload app). When I test in Flash, it loads the web.config file successfully and parses the file and populates my dropdowns. However, when I publish the file and test locally on my webserver, the onload fails. I am using the correct relative path (have done other XML apps and know to point from the dir my aspx file is in, not the swf). Am I running into a permissions issue? I'm not sure what do do here, or if it's even a good idea to try to access the web.config file via Flash.

  2. #2
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    The web.config is the asp.net configuration file, and I believe that by default IIS won't allow you to read this file.

    The easiest way to test this is to use a web browser and see if you can load the file.

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

  3. #3
    Member
    Join Date
    Mar 2001
    Posts
    78
    It is possible to edit the file purely through ASP.NET. I found a tutorial on this and have tested it. It's at:

    http://aspalliance.com/83

    My problem is integrating Flash into this. I have a fileupload app and I want to add an administrator section (only available through admin priveledges in my login credentials) that allows my clients to change the executionTimeout and the MaxRequestLength so they can customize it to suit their needs for their clients.

    I'm using XML.send() in Flash to push the flash file to the ASP.NET page (as request.form), and if I utilize an XML object in asp.net 2.0 it says the XML string is invalid. If I try to just stream the data to text, it does some weird conversion that looks like this:

    %3c%3fxml+version=%221.0%22%3f%3e%3 (there is more to the file, but this shows the weird conversion of tags)

    I can successfully pull the data from web.config in the Flash testing environment, but not when directly testing the ASP.net app with the Flash movie embedded. It gives an XML load error (by the way, is there any way to capture more than just success or not?). I might be barking up the wrong tree trying to create this functionality, but I thought it might be a cool feature (and save me the time of having to manually edit their config file).

    I'm wondering at this point if I need to stream the data via ASP.NET 2.0, then pull it into flash, then push the changes back to ASP.NET 2.0. I'm thinking my conversion issues are happening in Flash, since the ASP.NET editor for web.config works fine.

  4. #4
    Member
    Join Date
    Mar 2001
    Posts
    78
    Just in case someone wants to try to get it working, here's my actionscript:

    System.security.allowDomain(this.domain());

    myXML = new XML();
    myXML.ignoreWhite = true;
    myXML.load("web.xml");
    //myXML.load("http://localhost/upload2/web.config");


    myXML.onLoad = function(success) {
    if (success) {
    status_txt.text+="Settings info load: SUCCESS \r";
    parseXML();
    } else {

    //status_txt.text+="document failed to load "+httpStatus;
    }
    };
    function parseXML() {
    rootNode = myXML.firstChild;
    rootChildren = rootNode.childNodes;
    for (i=0; i<rootChildren.length; i++) {
    if (rootChildren[i].nodeName.toString() != "system.web") {
    } else {
    webNode = rootChildren[i];
    parseWeb();
    }
    }
    }
    function parseWeb(){
    webChildren=webNode.childNodes;
    for (i=0; i<webChildren.length; i++) {
    if (webChildren[i].nodeName.toString() != "httpRuntime") {
    } else {
    _global.childNo=i;
    editNode = webChildren[i];
    attribs=editNode.attributes;
    currentSize=attribs["maxRequestLength"]/1024;
    sizeTxt.text="currently set at "+currentSize+" MB";
    currentTime=attribs["executionTimeout"]/3600;
    switch (currentTime){
    case 1:
    timeCombo.selectedIndex=0;
    break;
    case 2:
    timeCombo.selectedIndex=1;
    break;
    case 3:
    timeCombo.selectedIndex=2;
    break;
    case 4:
    timeCombo.selectedIndex=3;
    break;
    case 5:
    timeCombo.selectedIndex=4;
    break;
    case 6:
    timeCombo.selectedIndex=5;
    break;
    default:
    timeCombo.selectedIndex=0;
    break;
    }
    if(currentTime==1){
    timeoutTxt.text="currently set at "+currentTime+" hour";
    } else{
    timeoutTxt.text="currently set at "+currentTime+" hours";
    }
    switch (currentSize){
    case 50:
    sizeCombo.selectedIndex=0;
    break;
    case 100:
    sizeCombo.selectedIndex=1;
    break;
    case 200:
    sizeCombo.selectedIndex=2;
    break;
    case 300:
    sizeCombo.selectedIndex=3;
    break;
    case 500:
    sizeCombo.selectedIndex=4;
    break;
    case 1000:
    sizeCombo.selectedIndex=5;
    break;
    default:
    sizeCombo.selectedIndex=0;
    break;
    }
    }
    }
    }
    _global.savechanges=function(){
    newNode = myXML.createElement(editNode.nodeName);
    for(attrib in attribs){
    newNode.attributes[attrib]=attribs[attrib];
    }
    newNode.attributes["maxRequestLength"]=(sizeCombo.selectedItem.data * 1024);
    newNode.attributes["executionTimeout"]=(timeCombo.selectedItem.data * 3600);
    status_txt.text+="size:"+sizeCombo.selectedItem.da ta+"\r";
    status_txt.text+="time:"+timeCombo.selectedItem.da ta+"\r";
    webNode.insertBefore(newNode, editNode);
    status_txt.text+="node name="+newNode.nodeName;
    editNode.removeNode();
    transactXML();
    }
    _global.transactXML = function() {
    status_txt.text+="\r transacting XML";
    status_txt.text+="\r"+myXML.toString()+"\r \r";


    myXML.send("transactXML.aspx", "_self");
    };

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center