When you post you page, you replace the value (with the split we tlaked about in the other thread with delimiter ‘$’ in my example) by the select index value of you
And you call a javascript on the ‘Onload’ of the form, which apply the selectindex like this :
If you want to do some things around embedded web site, you’ll have to know a bit on HTML, Javascript and so on…Instead it will rapidly be complicated in fact.
We may help you if you want…Just look at these just before to ensure we will understand each other :
@ agp89 - Now, after reading your post again, what you want to do is to read from the post, which is much simple and only need c# :
This code to replace your comment in the POST
// Get the POST parameters in the Header
if (_request.HttpMethod == "POST" && _request.InputStream != null && _request.InputStream.Length > 0)
{
_params = new HTTPRequestParamters(GetPostParams(_request.InputStream));
}
else
{
// POST without params means error !!!
_params = null;
_responsebuffer = _pagemanager.GetErrorBody();
}
This code that extract the POST params to a ‘&’ separated string
private string GetPostParams(System.IO.Stream post)
{
string _postparams = "";
try
{
// Get the byte stream
byte[] requestbuffer = new byte[post.Length];
post.Read(requestbuffer, 0, (int)post.Length);
// Convert to string
char[] charbuf = System.Text.Encoding.UTF8.GetChars(requestbuffer);
foreach (char car in charbuf)
{
_postparams += car;
}
// Return the params
return _postparams;
}
catch (Exception exc)
{
throw exc;
}
}
And finally this one which build a DIctionary with the params to facilitate their use
private ArrayList m_paramlist = new ArrayList();
/// <summary>
/// Default constructor that build the dictionary
/// </summary>
/// <param name="parameters"></param>
internal HTTPRequestParamters(string parameters)
{
try
{
// Split each pair of field/value
Array _paramarray = parameters.Split('&');
foreach (string _param in _paramarray)
{
// Split the pair in field and value
DictionaryEntry _entry = new DictionaryEntry(_param.Split('=')[0].Trim(), _param.Split('=')[1].Trim());
m_paramlist.Add(_entry);
}
}
catch (Exception exc)
{
throw exc;
}
}
I embed a website in the board to put some params like TCP Configuration, Password and so on…And it tooks me some time to build something similar to a dynamic web server engine with html and codebehind !
i got it to work, but not exactly how u suggested it, my code looks messy now…
this part:
_params = new HTTPRequestParamters(GetPostParams(_request.InputStream));
what does that line do, i mean the = new HttpRequestParamters part ?
also my compiler wants the method to return a value as it is internal, which is new to me aswell…
and where do i declare _params and what type is it supposed to be?
also how do i then access the list of Dictionary Entry’s… ( first time i heard of them)
I’m sorry for all this questions and that i took so much of your time already, but i only know C# since a few weeks, and just got my Spider but i already learned a lot from u today
OK, I missed a part of Code, the HttpRequestParamters is for me a Class, but do not take care of internal or other…First just put every method in the same class and call them as it is.
something like that :
_params = BuildPostParams(GetPostParams(_request.InputStream));
// Having :
private ArrayList BuildPostParams(string parameters)
{
ArrayList _paramlist = new ArrayList();
try
{
// Split each pair of field/value
Array _paramarray = parameters.Split('&');
foreach (string _param in _paramarray)
{
// Split the pair in field and value
DictionaryEntry _entry = new DictionaryEntry(_param.Split('=')[0].Trim(), _param.Split('=')[1].Trim());
_paramlist.Add(_entry);
}
return _paramlist;
}
catch (Exception exc)
{
throw exc;
}
}
@ Duke Nukem - It should, but as It wont have sense to give my entire solution, making a tiny sample project will take a bit time to mount…So if you’re patient, I will probably be able to put something on in the following days…