|
Sean Cleetus wrote: Sending an HTTP Request from my server to any other server and getting the response
They Should also Give Response To Ur Server If thts the Case Then Ok
If U R Working With Third Party Then They Have A interface /Or the Coding Methods to Follow
The Below Code Was Used By Me For Credit card Authentication Which Innvolves Both
IT May Help..!
private string CreditCardCheck(decimal bidamount)
{
string relayResponse = GeneralSettings.CreditCardRelayResponse;
string creditCardTestRequest = GeneralSettings.CreditCardTestRequest;
string creditCardDelimData = GeneralSettings.CreditCardDelimData;
string TrasactionId = "";
String result = "";
string expDate = "";
expDate = DropDownMonth.SelectedItem.Text + DropDownYear.SelectedItem.Text;
String strPost = "x_login=" + loginID + "&x_tran_key=" + trans_Key + "&x_method=CC&x_type=AUTH_ONLY&x_amount=" + bidamount + "&x_delim_data=" + creditCardDelimData + "&x_delim_char=|&x_relay_response=" + relayResponse + "&x_card_num=" + TextBoxCreditCardNo.Text + "&x_exp_date=" + expDate + "&x_test_request=" + creditCardTestRequest + "&x_version=3.1" + "&x_first_name=" + TextBoxCardholder.Text + "&x_last_name=" + TextBoxCardholderLastName.Text + "&x_company=" + TextBoxCompany.Text + "&x_address=" + TextBoxAddress.Text + "&x_city=" + TextBoxCity.Text + "&x_state=" + StatesDropDownlist.SelectedItem.Text + "&x_zip=" + TextBoxZipCode.Text + "&x_country=" + TextBoxCountry.Text + "&x_phone=" + TextBoxPhone.Text + "&x_fax=" + TextBoxFaxl.Text + "&x_email=" + TextBoxEMail.Text;
StreamWriter myWriter = null;
string url ="https://secure.authorize.net/gateway/transact.dll";
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
objRequest.Method = "POST";
objRequest.ContentLength = strPost.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
try
{
myWriter = new StreamWriter(objRequest.GetRequestStream());
myWriter.Write(strPost);
}
catch (Exception ex)
{
logger.Error(ex.Message);
}
finally
{
myWriter.Close();
}
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using (StreamReader sr =
new StreamReader(objResponse.GetResponseStream()))
{
result = sr.ReadToEnd();
string[] responsedetails = result.Split('|');
TrasactionId = responsedetails[6].ToString();
sr.Close();
}
if (result.ToLower().Contains("invalid") || result.ToLower().Contains("inactive"))
{
return "CreditCardis notvalid";
}
return TrasactionId ;
}
If It Helps Click It as Answer
|
|
|
|
|
Thanks you very much Sashidhar. This is exactly what I was looking/hoping for
|
|
|
|
|
Its Ok ..! Any Time..!
If It Helps Click It as Answer
|
|
|
|
|
I appreciate your effort. But few things to consider while replying,
1) Post only relevant code. The code posted by you has a lot of unwanted stuff.
2) Avoid using SMS language[^]. It is hard to read.
|
|
|
|
|
Ok Thx For Ur Suggestion I will Do From Next Time..!
If It Helps Click It as Answer
modified on Wednesday, September 23, 2009 7:37 AM
|
|
|
|
|
Most easy way to get a response from a URI is to use WebClient[^] class.
|
|
|
|
|
In perticular date the main report have record but subreport have no record.In this situation the subreport retrieve all the data from table.
How to supress sub report when this situation. Please help me..........
|
|
|
|
|
I think Here U Will Not Get Most Help For reports Questions I suggest U to Post In General DataBase Or Different Forums .I am Telling U this With My Own Experience..!
If It Helps Click It as Answer
|
|
|
|
|
Can Any One expain the dis advantaged of LINQ,like where i Can use and where I can not...
Thanks,
Srinivas Mateti
|
|
|
|
|
Disadvantages of LINQ over Stored Procedures
-----------------------------------------------
1) Network traffic: sprocs need only serialize sproc-name and argument data over the wire while LINQ sends the entire query. This can get really bad if the queries are very complex. However, LINQ's abstraction allows Microsoft to improve this over time.
2) Less flexible: Sprocs can take full advantage of a database's featureset. LINQ tends to be more generic in it's support. This is common in any kind of language abstraction (e.g. C# vs assembler).
3) Recompiling: If you need to make changes to the way you do data access, you need to recompile, version, and redeploy your assembly. Sprocs can sometimes allow a DBA to tune the data access routine without a need to redeploy anything.
|
|
|
|
|
S.Dhanasekaran wrote: Disadvantages of LINQ over Stored Procedures
How a comparison is possible between LINQ and Stored Procedures?
|
|
|
|
|
sris 426 wrote: Can Any One expain the dis advantaged of LINQ
In ASP.Net Forum?
I would have chosen LINQ [^]forum forum for that
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.
|
|
|
|
|
I dont want my Data Layer to Contain SQL Manupilation. Linq does that. I like Linq to Object. Am not a Fan of Linq to SQL
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
What About LINQ to XML and other options? I am using linq to load and process XML file? Will it give any extra burden to Application. Please advise.....
Thanks in advance
Srinivas Mateti
|
|
|
|
|
Anyhow, you are somewhat comparing apples and oranges. LINQ to XML (and LINQ in general) is a query language whereas XSLT is a programming language to transform XML tree structures. These are different concepts. You would use a query language whenever you want to extract a certain specific piece of information from a data source to do whatever you need to do with it (be it to set fields in a C# object). A transformation, in contrast, would be useful to convert one XML representation of your data into another XML representation.
So if your aim is to create C# objects from XML, you probably don't want to use XSLT but any of the other technologies offered by the .NET Framework to process XML data: the old XmlDocument, XmlReader, XPathDocument, XmlSerializer or XDocument. Each has it's special advantages and disadvantages, depending on input size, input complexity, desired output etc.
|
|
|
|
|
Vuyiswa Maseko wrote: I dont want my Data Layer to Contain SQL Manupilation.
So what does your data layer contain?
only two letters away from being an asset
|
|
|
|
|
In my Data Layer i call the SP that does the Necessary manupilation. What i mean is that you will never Find select statements in my Data Layer.
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hello!
I'm kinda new to ASP.net so i am just testing and failing, so maybe the approach i am going for is just wrong if so tell me =)
I'm trying to print a sequence of HTML code with Response.Write ... works fine enough, but i am interested in printing this code at a specific point on the page...
Currently i am trying to do that from the class with the method Page_Load, with the event of a button click...
Don't know if that explain it..
|
|
|
|
|
Thekaninos wrote: but i am interested in printing this code at a specific point on the page...
Put a literal control on the area where you need it to be printed. Set the HTML code to literal's Text property.
|
|
|
|
|
Hello
I am developing one web application.I want to use language options for this application.
I have gone through resource files but i didn't get one point which is
how to add values into different language means i add string as Name how to
convert name into French language into value.and My full site has 50 pages how to convert each and every page string values through resource file.
Pls explain me in details if u know this point.
Thanks.
|
|
|
|
|
|
Hi all,
I have one doubt, i am fetching data from database and i am displaying data in gridview.(select empid,empno,covert(varchar,dateofbith,101),convert(varchar,joiningdate,101) from emptable) (values are:1,12,'12/31/1986','12/31/2008')
i am not using any boundfields in gridview.
i am using this code to sort the gridview columns,everything is working fine but dateofbirth,joiningdate fields sorting is not working .
i am using below code to sort the gridview columns:
If Not (Page.IsPostBack) Then
ViewState("Sort") = "asc"
end if
and
Protected Sub grdCommon_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles grdCommon.Sorting
Try
grdCommon.DataSource = Session("grdCommon")
grdCommon.DataBind()
Dim dataTable As DataTable = CType(grdCommon.DataSource, DataTable) ' DirectCast(ViewState("grdCommon.DataSource"), DataTable)
Dim dataView As DataView = New DataView(dataTable)
If Not (dataView Is Nothing) Then
If ViewState("Sort").ToString() = " asc" Then
ViewState("Sort") = " desc"
Else
ViewState("Sort") = " asc"
End If
dataView.Sort = e.SortExpression + ViewState("Sort").ToString()
grdCommon.DataSource = dataView
ViewState("grdCommon.DataSource") = dataView.Table
grdCommon.DataBind()
End If
end sub
Regards
Rama
samrama
|
|
|
|
|
hi,
Here i add a sample code for sorting
1) In Gridview Properties add this
AllowSorting="true" OnSorting="gridView1_OnSorting"
2) In gridView use TemplateField Column
<asp:TemplateField HeaderText="joiningdate" HeaderStyle-HorizontalAlign="Left" SortExpression="joiningdate" ItemStyle-Width="30%">
<ItemTemplate >
<span id="joiningdate" runat="server" style="color:Black;" ><%#Eval("joiningdate") %></span>
</ItemTemplate>
</asp:TemplateField>
3) create a Event gridView1_Onsorting
protected void gridView1_OnSorting(object sender, GridViewSortEventArgs e)
{
string sortExpression = e.SortExpression;
ViewState["sortExpression"] = e.SortExpression;
if (GridViewSortDirection == SortDirection.Ascending)
{
GridViewSortDirection = SortDirection.Descending;
SortGridView(sortExpression, "DESC");
}
else
{
GridViewSortDirection = SortDirection.Ascending;
SortGridView(sortExpression, "ASC");
}
}
4) Create a SortGridView() Method
private void SortGridView(string sortExpression, string direction)
{
DataTable dt = null;
dt = "test" // fill the Datatable rows using sqlcommand or Dataset
DataView dv = new DataView(dt);
dv.Sort = sortExpression + " " + direction;
gridView1.DataSource = dv;
gridView1.DataBind();
}
5) Create a enum SortDirection
public SortDirection GridViewSortDirection
{
get
{
if (ViewState["sortDirection"] == null)
ViewState["sortDirection"] = SortDirection.Ascending;
return (SortDirection)ViewState["sortDirection"];
}
set { ViewState["sortDirection"] = value; }
}
|
|
|
|
|
Hi,
How to save data from a html table to database.
eg: my html table, it is dynamically generated using string concadination
name age address city
N1 10 xyz abc
N2 20 abc xyz
I need to read this html table and save it to database
How to do this?
Thankyou
YPKI
|
|
|
|
|
Say you paste the html into a container div. Now you can get the inner HTML in the server side of the div. Now parse the table from it.
Otherwise if you like to create the entire htmlTable with view state and all, you need to create the object during pre_Init.
|
|
|
|