Httphandlers and JSON

Oct 23 2009 2:13 PM
Ok i am completely new to json and C# as a whole. Read up on C# and found it to be similar to java but Httphandlers, web.config files, JSOn are new to me. A question assigned to me was:


  Main Handler (main.ashx) Parameters:

 

·        html=<HTML request data (in JSON format)>

o  Descr:  If the "html" parameter is passed, then the SPS must return an HTML page, whose content will be based on the details assigned via the following JSON-formatted key-value pairs:

§  "image" :

// Specifies the "image" details (e.g.:  "<img src='./main.ashx?type=img&height=80&width=460'/>

{

"count" : <min=1, max=100>,

"height" : <default=80, min=1, max=1000>,

"width" :  <default=460, min=1, max=1000>,

}

 

§ "css" :

// Specifies the #-of-CSS files to put in the HTML output (e.g.: "<link rel='stylesheet' href='./main.ashx?type=css&size=1000'/>

{

"count" : <min=1, max=100>,

"size" : <default=100, min=100, max=100000>,

}

 

§ "js" :

// Specifies the #-of-JavaScript files to put in the HTML output (e.g.: "<script src='./main.ashx?type=js&size=1000'/>

{

"count" : <min=1, max=100>,

"defer" :  true | false (default),  // Note:  If set to true, then apply the "defer=true" attribute to the script tag

"size" : <default=100, min=100, max=100000>,

}

 

§ "iframe" :

// Specifies the #-of-JavaScript files to put in the HTML output (e.g.: "<script src='./main.ashx?type=iframe&size=1000'/>

{

"count" : <min=1, max=100>,

"size" : <default=100, min=100, max=100000>,

}

 

·        type=<img|css|js|iframe>

o  Desc:  Specifies which type of file to return.

o  Note:  Initially, just create the given file type on the fly.  We'll worry about optimizing this later
ok how does one recieve the request? Need help on the get/post parts in web.config, what will the request look like and what is the solution to this??? thanks guys.

Answers (2)