|
Hi everyone ,
I need to capture the response_code value of the website :
https://secure.merchantonegateway.com/api/transact.php
In the page i need to capture the response_code value.
In the page load i am using Response.Redirect('https://secure.merchantonegateway.com/api/transact.php?id=response_code');
But i am want the value of response_code in my page.
can anyone please send the code or suggest to get the value of how to get the response_code value .
Thanks
Murali
|
|
|
|
|
Response.Redirect will not give you response_code it will only redirect page to given link.
You can use httpwebrequest and httpwebresponse class to get response_code.
|
|
|
|
|
I think You are using the third party for credit/debitcard values.
What is the merchant name You are using?
Depending on the third party the code changes..!
You have capture the response..!
This Is not the way of capturing the value.
You need to use Stream reader and http object response..!
Check this Link it may help..!
http://www.codeproject.com/Messages/3208439/Re-Post-an-HTTP-Request-from-one-WebServer-to-anot.aspx[^]
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
modified on Tuesday, November 24, 2009 2:26 AM
|
|
|
|
|
If you are only bothered about the Response, dont use Redirect. Redirect actually navigates to the page, so if you use it, your own contextual response will get modified with the response.
So if you what to get the response, you need to invoke another HttpRequest to the web path.
string url = "https://secure.merchantonegateway.com/api/transact.php?id=response_code"
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
result = sr.ReadToEnd();
sr.Close();
}
Now result will hold the Response.
I think this is what you require.
|
|
|
|
|
Hello ,
I have executed the code the if we give a valid credit card number also the result is the same. so is there any other ways . The responsecode is always 300.
Thanks
Murali
|
|
|
|
|
I have a GridView where I can export to excel file.
In the beginning of the page where gridview is, I have the following:
<b>Bem vindo <% Response.Write(Session["nome"].ToString()); %>!</b>
Now I've tested the export funcionality again, and having the following error:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
I googled about it, and looks like because Response.write does not allow the export encoding operation perform correctly, so I commented that line, and now its working again.
So I'm wondering, I really want to use that line. How do I do it? Is it possible?
Many thanks.
|
|
|
|
|
Response.Write is idiocy in this context. Just remove it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: Response.Write is idiocy in this context. Just remove it.
I havent asked you if its idiocy or not.
I asked you if there is a alternative or solution.
|
|
|
|
|
Maxdd 7 wrote: Bem vindo <% Response.Write(Session["nome"].ToString()); %>!
whats tht '!'
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
That's why he is getting the error !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I thought So..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Solution has already provided by CG, but he is not interested with that solution.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Use
<% =Session["nome"] as string %> instead of <% Response.Write(Session["nome"].ToString()); %>.
As Response is implicit here for the Designer, you cant access it directly.
|
|
|
|
|
Abhishek Sur wrote: <% =Session["nome"] as string %> instead of <% Response.Write(Session["nome"].ToString()); %>.
That way gives the same error.
Maybe you are all right, I really should remove that. I was trying do that because I had a problem using LoginView:
<asp:LoginView id="logview" runat="server">
<LoggedInTemplate>
Welcome <asp:LoginName id="txtUserName" runat="server"/>
</LoggedInTemplate>
</asp:LoginView>
The problem is: since the login name is email ID, (and the name of the user is another field in DB), it appears something like "Welcome tmm@yahoo.com"
|
|
|
|
|
Yeah... I think this solves the problem.
Other than that you can store the Displayname in a protected variable in server side and use <%=yourvariable%> also.
|
|
|
|
|
Hi
I am looking to ask whether anyone can point me in the right direction to a solution involving JavaScript, a HTML table and print.
What I have is a HTML table, which includes paging and a column with hyperlinks. However, what I am looking to do is to print out the table, but not to include the column with hyperlinks, and to print the whole table without the paging. My aim is to not to regenerate the table again from another query, but to use the sam query and page.
Does anyone know how it is possible to do this?
|
|
|
|
|
The only way to do this is to have a popup showing only what you wnat to print, and printing that. That's why every site that does anything like that, does it that way.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Yes you can do so, but the page should contain the entire data. I mean if you have some portion of the table is in the server which comes whenever your page is posted back, you cant print that portion.
Just load the entire table content when the page loads.. (you may hide the portion that you dont want to show in the page using display = none css property)
Now to print the content apply CSS Ruleset for @media print
You can easily hide elements from printing using this rule. Just add display:none for the elements that you want to hide in @media print css.
Take a look at the w3 documentation on @media css.
http://www.w3.org/TR/CSS21/media.html[^]
I am sure this will help you.
|
|
|
|
|
Hi,
I need to render a TreeView control relative to the width of the window. I can place the TreeView in a to show scrollbars, etc. but it seems that if I wish to set the control's width relative to the page size, so that it changes width as the user changes the window size using the mouse, I'm stuck. I can set a specific width and that works fine but if I try and set a relative column width, say 50%, the control ignores the width of whatever control it's in context of. The problem is that a user may have their resolution set to XGA or WUXGA so I need the flexibility of relative sizing as opposed to fixed.
Thanks for any advice offered
|
|
|
|
|
Put the TreeView inside a div tag.
The parent div tag should have the style display:block, width 100%;.
Add a css class for the treeview set display:block, float:left, width:50%. Give that a try.
I didn't get any requirements for the signature
|
|
|
|
|
I did that but the TreeView was instantiated at page load as the same width as the widest TreeViewItem. Further, when I selected an item in the TreeView, it subsequently *increased* the width of the TreeView to accommodate the selected item.
As you can imagine, I'd like the page to load, and for the TreeView's width to always be governed by the size of the containing element, in this case, a table column and contained div.
It seems that if I set a specific width for the TreeView, it remains at that width no matter how wide the TreeViewItems are. I just don't see why the TreeView control can't inherit its width from the containing element - where the table is defined as 100% the width of the page and the containing column is set to 50% of that.
|
|
|
|
|
Yes.. this is really a problem. Actually Treeview has a min-height specified. So if you resize, it wont go after a certain width.
So you want the scrollbar to appear after it reaches a certain size. As it always holds its min width, you can set the width of the container to show the scrollbar of the container.
Just place the treeview inside of a <div> with overflow:auto for width. For example
<div style="width:128px;overflow:auto">
<asp:TreeView runat=... </div>
Hope it solves your problem.
You can use
<asp:TreeView ID="TreeView1" runat="server" Width="178" ...
to define width of the Treeview.
|
|
|
|
|
I'm afraid that's exactly what I've tried doing. Placing the div around the control provides the TreeView with the scroll bars I need but it doesn't allow me to control the relative width of the TreeView. It seems the TreeView's width is governed by the width of the TreeView Items it contains unless the width is specified. Of course, if I resize the page, the TreeView remains at the same size which is fine if you know what resolution the user will be using, but if the user can display the page in anything from XGA to WUXGA, what looks fine on a low resolution screen will look pretty poor on a high res one
|
|
|
|
|
Yes, as an user, it is not good to have horizontal scrollbar in place. Users generally dont like to scroll the horizontal scroll bars(at least web users).
How about dealing width dynamically using JS ? You also need to have a minimum width set, so that every time the browser resizes, you need to trap browser resize event and set the size of it dynamically using javascript.
I generally do make the site in certain fixed resolution, and leave blank space around the content when in high resolution... if full screen content is not required exactly.
Depending on your requirement you need to make your site.
|
|
|
|
|
Generally, speaking I do try and ensure I use fixed sizes for my ASP.NET sites. Unfortunately, in this instance, a user asked if the width of the TreeView could be increased. They're using a high-res screen but other users use laptops with relatively low-res screens. The content of the TreeView can be very wide which is why the high-res user wants to take advantage of the res they're working at. The only other thing I can think of is to use a fixed width and display a Tooltip showing the full text of a TreeViewItem that the mouse is positioned over.
It really is a pain that the TreeView is so inflexible and it's unacceptable that it's never been fixed considering how long it's been available to developers :/
I now have to implement a fix which will be at best a compromise
|
|
|
|