Introduce DataBase,Asp.net,JavaScript,Xml,Html,Css,Sql,Php,ASP.NET Controls,AJAX,Tools,HTML,CSS,JavaScript,Open Source Project,WPF,.Net Framework,Linq
Top Recommended Hosting

set up project - retriving text box value

by the3factory 5/10/2008 7:47:00 PM
Question:

Hello all,

 I am planing a set project for a web site application, there are two unsolved issues that i would like to share with you

and fortunly get clear idea about how to acomplish it.

 

 I need to retrive a text box'es text property and deploy it on the web config file,or any other xml file with the above value,

I know how to raise the install event on a webapplication but i need it on website,

anyway it would be good enoufh if i could save an xml file on the same location of my web site,but web aplication dont seem to "know" the path to the actual iis location

I attached my webaplication class ,Please let me know what should i do

Great day,

 tal g.

 

 

public class Class1:Installer

{

public FileStream sw;

public XmlSerializer xml_serializer;

public override void Install(System.Collections.IDictionary stateSaver){

 

sw =
new FileStream("../config.xml", FileMode.CreateNew, FileAccess.Write);xml_serializer = new XmlSerializer(typeof(string));

 

add_node("PathValue1", Context.Parameters["PathValue1"].ToString());

sw.Close();

}

public void add_node(string _key, string _value)

{

    config_node _config_node = new config_node(_key, _value);

    xml_serializer.Serialize(node

}

 

}

 

 

 


Answer1:

To get the physical path, you can use the MapPath function on the page. It would look like this:

 

sw = new FileStream(this.MapPath("../config.xml"), FileMode.CreateNew, FileAccess.Write);xml_serializer = new XmlSerializer(typeof(string));


Answer2:

Hi 

Thanks for the rapid answer,

The problem is that the raised event (installer method) which raise after installation of the project (MSI)  could be reched only on a new project i just

specificly for this mission created(Web apllication proj) ,

The web site is my base project and I couldnt figure out how to raise install event on this project.

 I tryied your solution(On the web application) but the intelisense dont know the mappath method,

Is a namespace missing? or that web application cant connect to local host url? - By my common sense the secound option seem to be the corect,

Am i right?

Maybe there are some other options?

Much Thanks

Hope I was a little more understood.

 

 


Related posts

Sign up for PayPal and start accepting credit card payments instantly.


Powered by BlogEngine.NET 1.2.0.0