I am getting a URL from PIC 32 controller using it's post function.
which is like, www.example.com/Default.aspx?x=12&y=23
What I want to do is that when I get the URL, I want to store the values of x and y into SQL Server.
As PIC Controller cannot generate the button event so I need to store the data when the URL is being post on the server.
As per I think this needs to be done on page load. Is it?
Yes do it in a page load.
Access those strings using below syntax:
int x=Integer.ParseInt(Request.QueryString("x").ToString)
int y=Integer.ParseInt(Request.QueryString("y").ToString)
Then insert the values into database.
Related
How can I retain HTML form field values in JSP after submitting form to Servlet?
I am trying to retain a csv file in the jsp but it looks not possible. I also tried to pass the csv file back to the jsp and send it as a part of form back to the controller but not able to do it. so please suggest a way to retain the csv file or redirect it back to the jsp and be able to use the second time the page reloads
I have done some research and came to a conclusion that it is not possible to retain an input field of type csv file. Please correct me if I am wrong
Answer: As per my knowledge it is not possible as suggested in this https://stackoverflow.com/questions/2598904/how-do-i-keep-form-data-after-submitting-the-form-using-javascript#:~:text=To%20keep%20the%20values%2C%20you,request%20parameters%20into%20the%20fields.&text=You%20can%20use%20cookies%20from,you%20access%20something%20called%20document. answer once the form is submitted the entire page is replaced by response from the server so to retain the csv file values I think we can only use an jQuery.post or jQuery.ajax to send the form data rather than actually submitting the form
If you want to retain any thing that was passed from a jsp and use it in back end, you can do one thing . once passed to the controller, we can read the data of the csv file and set that object in the session using .setAttribute("object name", object). The session object can be fetched and set an object using the following lines of code
HttpSession session = request.getSession();
session.removeAttribute("<object name>");
session.setAttribute("<object name>", object);
and use this object the second time the control moves from jsp to controller by using the getAttribute()
<className> <objectName> = session.getAttribute("<object name>");
and use it as needed.
My task is the following, I need a way to store a query string value of s and pass it to the merchants Order Confirmation email.
consider the following,...mybigcommerce.com?s=fb.
Let's say that my client posts his website link to facebook and adds in a query string of s with a value of FB (facebook).
The desired result would be that on the initial load of the page, the query string would be saved as a cookie(or in Bigcommerce's case a global or store front variable)
Once I have it saved, I now know that you just simply append the variable to the email template.
example output:
email template source : %name_of_variable%.
My problem is, however, I don't see how to store the value into a variable.
Can I accomplish this without using the API, or for that matter can I do this using the API?
Thank you in advanced, I hope I have provided enough information.
Unfortunately, you cannot create your own variable in the email templates. The variables used here have been created and are supported by code within the core application. As such, it would require a core application change to extend existing functionality/add a variable. There isn't a way for you to write to an existing variable either.
Ok, I've been bugging with this for too long.
I need to call my website from a rough VB.net app. Then only thing I need is to attach a query string parameter to the calling url, so I can distinguish the pages to be shown to different VB app users.
So I want to click a button and launch that website, giving this parameter.
First I was bugging with adding the system.web libraries. Now I can't use Request/Response.QueryString as well.
I tried getting some example help from this post. but as I said before - I cannot make use of Request.QueryString as I cannot import it.
I am stuck here:
Process.Start("http://localhost:56093/WebSite1?id=")
I need to attach a query string parameter to the url and then open the website with that url.
Can someone just give me a sample code for my problem.
Query parameters are parsed by the web server/http handler off the URL you use to call the page. They consist of key and value pairs that come at the end of the URL. Your code is nearly there. Say you needed to pass through the parameters:
ID = 1234
Page = 2
Display = Portrait
Then you'd turn them into a URL like this:
http://localhost:56093/WebSite1?ID=1234&Page=2&Display=Portrait
Therefore in your code you'd have:
Process.Start("http://localhost:56093/WebSite1?ID=1234&Page=2&Display=Portrait");
I have a page "Demo.aspx". I need to set some parameters using post method and redirect the page to "DemoTest.aspx".
Is there any way to set parameters in post method in asp.net? I don't want to set "Querystring" due to security propose.
Also I need server side code for this. I am not able to use "Javascript" or "Jquery" for the same.
Here is some more description for the same.
Right now I am using Response.Redirect("www.ABC.Com/DemoTest.aspx?P1=2"). So the page is simply redirect to the given URL.
Now I don't want to pass that "P1" in "Querystring". Instead of query string I want to use Post method.
Please note that redirection page is not in my own application. So I cant maintain session or "Viewstate".
Thanks in advance.
Use a session variable and response.redirect to the next page.
Session["MyVariable"] = "someThing";
Response.Redirect("DemoTest.aspx");
The value stored in Session variables will be accessible across application.
you can store in session like this :
Session["id"] = "anyID";
To get values On another page you need to write
string id = Convert.ToString(Session["Id"]);
However
By default, in .NET pages post() do the things automatically.
You will need to do sumthing like this:
Server.Transfer("DemoTest.aspx", True)
I want to understand what link is formed when I click print button on http://recruitment.cdacmohali.in/TETPB/Regprintagain.aspx
Sample data is 2011360220 and 25/05/1980
I want to integrate it with my website and get the url it it making so that in the url I can pass the registration number and dob as variable and see the complete results.
I think it is using Session. You can not pass the data by QueryString