|
benams wrote: it's not working...
And what does it has to do with ASP.Net? There is a better place[^](Web Development Forum) at CP for these type of questions.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Could you please explain your problem in a more elegant way?
It will be easy for others to grasp and solve.
Niladri Biswas
|
|
|
|
|
Hi my fellow coders,
I'm trying to HTTP POST some data to a URL (API).
If I directly try on the browser, it works fine and giving the below response:
<?xml version="1.0" encoding="utf-8" ?>
<OUTPUT>
<STATUS>ERROR</STATUS>
</OUTPUT>
But If I use webclient class, the response is different, and is not posting the data at all:
<?xml version="1.0" encoding="utf-8"?>
<OUTPUT><STATUS>HTTP/1.0 200 OK
Content-Type: text/xml
Content-Length: 100
<?xml version="1.0" encoding="utf-8"?>
<OUTPUT><STATUS>SUCCESS</STATUS></OUTPUT></STATUS>
</OUTPUT>
Can my fellow experts give ma a hint on how should I mimic the browser results?
|
|
|
|
|
Give me code by that you are calling web service you are missing something.
You can also do remote debugging for your web service by that you found exact problem for remote debugging just attach process by which you are calling your web service if that is different machine then run webserive and put break point into web service when client call web service automatically execution stop on your break point.
|
|
|
|
|
Member 2102804 wrote:
If I directly try on the browser, it works fine and giving the below response:
<status>ERROR
How did you try on browser ?
Member 2102804 wrote: But If I use webclient class, the response is different, and is not posting the data at all:
<status>HTTP/1.0 200 OK
Content-Type: text/xml
Content-Length: 100
<status>SUCCESS
You want to mean, when you are posting the file from your client application ?
|
|
|
|
|
Hi...
Thank you for your response, FYI, it's not a webservice, it's a normal HTTP URL
Trying on browser, means typing the url in the browser's address, click below to try
http://gateway.ionnex.com:8001/sendsms.aspx[^]
(note this is not the url I'm testing as that url is only accesible via my server)
And I'm not posting file, just parameters and values.
I believe my client application is bug free as it works for other URL (API) but not this one, seems it's giving me the HTTP 200 status instead of the status from the server.
|
|
|
|
|
In my page, I have a datatable with duplicate data and I use the following code to make distinct column values.
private ArrayList RemoveDuplicatePartNumbers(DataTable dtParts)
{
ArrayList lstparts = new ArrayList();
DataTable dt1 = new DataTable();
//Assigning the table to DataView, which will remove duplicates after sorting.
DataView dv = new DataView(dtParts);
dv.Sort = "PartNumber ASC";
string[] strcolumns = { "PartNumber" };
dt1 = dv.ToTable(true, strcolumns);
for (int i = 0; i <= dt1.Rows.Count - 1; i++)
{
lstparts.Add(System.Convert.ToString(dt1.Rows[i]["PartNumber"]));
}
return lstparts;
}
Now my question is, can I reduce the above coding lines to some extent by using DataView.Select property or in some other way? Any thoughts? Please help.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi, you can fire a Linq query instead.
I have created a Datatable
public DataTable FunctionGetTable()
{
DataTable dt = new DataTable();
dt.Columns.Add("PartNumber");
dt.Rows.Add("PartNumber1");
dt.Rows.Add("PartNumber5");
dt.Rows.Add("PartNumber6");
dt.Rows.Add("PartNumber3");
dt.Rows.Add("PartNumber3");
dt.Rows.Add("PartNumber6");
dt.Rows.Add("PartNumber3");
dt.Rows.Add("PartNumber5");
dt.Rows.Add("PartNumber5");
return dt;
}
My ArrayList function goes like this
private ArrayList RemoveDuplicatePartNumbers(DataTable dtParts)
{
ArrayList lstparts = new ArrayList();
var query = (from c in dtParts.AsEnumerable()
orderby c.Field<string>("PartNumber")
select c).Distinct(DataRowComparer.Default);
foreach (var d in query) lstparts.Add(d);
return lstparts;
}
Next call the function from any control's event(I have called from a button event)
protected void Button1_Click(object sender, EventArgs e)
{
ArrayList RequiredList = new ArrayList();
RequiredList = RemoveDuplicatePartNumbers(FunctionGetTable());
}
Hope this helps
Niladri Biswas
modified on Wednesday, July 1, 2009 8:22 AM
|
|
|
|
|
Thanks a lot for your detailed reply. It worked!!! and I learned something about Link queries. Great Forum!!!
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi..
I have hosted my Asp.net application on Godaddy shared hosting environment. Now I want to upload images to my hosting server by using my code. So I used file upload control to upload my files, when I am trying to upload file on to my web server every time it's prompting window for user name password of my domain .can anyone tell me how can I upload a file on to my shared hosting environment without prompting authentication window.
Thanks in advance.
bah10z
|
|
|
|
|
You need to have appropriate permissions to write(upload) a file on the server.
Read this [^]on MSDN to understand what all permission you would need.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
engbahramZarin wrote: when I am trying to upload file on to my web server every time it's prompting window for user name password of my domain .
Do you have the sufficient permission to upload the file ? is there any domain user name password you have for the hosting side?
|
|
|
|
|
I have four individual checkboxes in my form called as General, Direct, Indirect and Private. The issue is that when private is checked all others should be disabled and unchecked if checked. I have the following code for that:
if (PrivateCheckBox.Checked)
{
GeneralCheckBox.Checked = false;
GeneralCheckBox.Enabled = false;
IndirectCheckBox.Checked = false;
IndirectCheckBox.Enabled = false;
DirectCheckBox.Checked = false;
DirectCheckBox.Enabled = false;
}
else
{
GeneralCheckBox.Checked = true;
GeneralCheckBox.Enabled = true;
IndirectCheckBox.Checked = true;
IndirectCheckBox.Enabled = true;
DirectCheckBox.Checked = true;
DirectCheckBox.Enabled = true;
}
This serves the purpose but simply increases coding lines which I don't want. I can use the ternary operator, but only one operation can do with that, either checked or enabled. Can anybody have any idea how to achieve this with minimum line of code? I am not able to think of any other option.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
GeneralCheckBox.Checked = GeneralCheckBox.Enabled = !PrivateCheckBox.Checked;<br />
IndirectCheckBox.Checked = IndirectCheckBox.Enabled = !PrivateCheckBox.Checked;<br />
DirectCheckBox.Checked = DirectCheckBox.Enabled = !PrivateCheckBox.Checked;
only two letters away from being an asset
|
|
|
|
|
Add the check boxes (except private check box ) to a checkbox group. and use this code
foreach (CheckBox ch in CheckBoxList1.Items)
{
if(private.checked)
{
ch.Checked = false;
ch.Enabled = false;
}
else
{
ch.Checked = true;
ch.Enabled = true;
}
}
If you want to do similar kind of operation to a group of items then this is the standard way of doing that. Hope this help
|
|
|
|
|
foreach (control ctrl in page)
{
if(ctrl is checkbox)
{
((checkbox)(ctrl)).enabled = false;
((checkbox)(ctrl)).checked = flase;
}
}
|
|
|
|
|
This will not work, as it is giving the error as " foreach cannot operate on variables of type System.Web.UI.Page because System.Web.UI.Page does not contain a public definition for 'GetEnumerator'"
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi All
i am assingning a dynamic value to image through hidden feild value and it is not working.
the tag is
<img src="<%hidden1.value%>" alt=""/>
this does not show any image and on checking the properties of image it says no URL defined
Thanks in advance!!!!!
|
|
|
|
|
<%=
you are missing "=" char
|
|
|
|
|
IT_Help wrote: the tag is
use
IT_Help wrote: this does not show any image and on checking the properties of image it says no URL defined
What is the hidden1.value returning, From Are you giving the path ??
|
|
|
|
|
Add this code in your aspx page.
<INPUT type="hidden" id="MyHiddenField" runat="server" value="http://tbn2.google.com/xy/ab.JPG">
<img runat="server" id="hiddenImg" alt="" />
and in code behind add this code
HtmlInputHidden hidden = (HtmlInputHidden)Page.FindControl
("MyHiddenField");
Img.Src = hidden.Value;
Hope this help.
|
|
|
|
|
how to check whether Nodes has ChildNodes or not, when i calling i nodes from database.....will it be checked on any NodeExpanded event and if yes give me some guidance
|
|
|
|
|
KhandelwalA wrote: how to check whether Nodes has ChildNodes or not, when i calling i nodes from database.....will it be checked on any NodeExpanded event
I didn't understand your problem. Can you please explain clearly ?
Thank you !
|
|
|
|
|
Hello Friends,
I've two dropdownlist(ddlCountry,ddlState). Onchange event of CountryDropdown(ddlCountry) StateNames are displayed into StateName dropdown using javascript. And it's working fine but prooblem is if i print the value of selected StateName on a button click at code-behind i got an error <b>Object reference set to an instance of an object</b>. So can anybody let me know what should i do know
|
|
|
|
|
your question is clear... Plzzzz send the code upto which level you have tried and the line where u r getting that error...
|
|
|
|