I want my website to be shown on a 'kiosked' computer (i.e. the site is the only thing visible on the screen). And I have a card reader that sends a string to whatever text field is active when a card is shown to it. After the string the card reader sends a tab-key.
Now how could I receive the string each time the card is shown and at the same time keep the website active at all times. When the tab-key is sent it should not tab to the address bar or anywhere else, if it would then I wouldn't receive the next string as the site wouldn't be active any longer.
Also, the received string should never be visible on the the screen, I just want to receive it in the code behind.
How might I solve this?
You could handle the change event of the textbox and post the data via AJAX to your controller then re-focus the field.
Also, the received string should never be visible on screen
Few ways of doing that, make the field blend into the page (e.g. change the background/fore colour) or hide it by putting a div over it etc.
Related
What I am trying to achieve is this:
I am sending an email to someone within my organization asking them to attend a meeting (this will all be on the same domain, i.e. #gmail.com), From here, I want them to be able to click a button or label, which will send an email to a specific person (so basically a confirmation email that they accept the meeting). I am sending the 1st email in C# by using the following code:
string theBody = "Do You Accept: " + "Click Here/Button"
Message objMessage = new Message();
objMessage.NameFrom = Convert.ToString(ConfigurationManager.AppSettings["SMTPSendingName"]);
objMessage.EmailFrom = Convert.ToString(ConfigurationManager.AppSettings["SMTPSendingEmailAddress"]);
objMessage.NameTo = "Subject";
objMessage.EmailTo = "To#email.com";
objMessage.EmailMessage =
string.Format(theBody);
Where I have written "Click Here/Button" is where I would like the clickable text or button, that sends an email back to a hard coded email address, something like the following:
string returnEmail = "mailto:return#mail.com?subject=Accepted?body=" + theBody;
To Clarify:
An email is sent to person a from C# using the above code block 1
When person a receives the email, I want them to be able to click a button or clickable text, that in turn sends an email to a person b
This clickable button or text must be embeded in C#
My Organisation are using Outlook 2016
This is they way I though would be best, however I am open to any better suggestions into how I can achieve something like this. Thankyou in advance for your help.
Below is an example image of what I have, as you can see its just a long hyperlink, which does work for now. This opens up a new outlook message, and the user has to press send. I would prefer this to happen all in one click but if this is not possible, then that is ok.
You could have an endpoint in your api, that will be hit when the user clicks on accept. On that endpoint, you could use Office365 APIs (https://msdn.microsoft.com/en-us/library/office/dn776319(v=exchg.150).aspx), more specifically, the Calendar API, to accept the meeting.
You can't. HTML in Outlook is rendered by Word, and it will not run any scripts. The best you can is provide a link that will be opened in the user's browser, which can then do something meaningful.
have you considered a custom outlook form?
https://msdn.microsoft.com/en-us/library/office/ff868929.aspx
If you're not on an exchange backend, you might have to send the form template around to your users. Exchange allows for "Organizational Forms" which all users can get.
The custom form allows you to add buttons and code-behind in the custom form for very much what you are asking.
I'm trying to program a tracking system in C# (a windows application.)
What I'm trying to do is once button is clicked, IE (or chrome) is opened,
and track the items with numbers in the textbox automatically.
The site is http://drc.edeliver.com.au/track/
In the Australia post page, I want my number in the *Enter tracking number* automatically.
Is it possible?
Tracking sites often have a method of supplying a direct link to track something. In your case, for Australia post, it is like this:
http://auspost.com.au/track/track.html?id=1234
where 1234 is the tracking number.
To run an application (or url etc), you can use the following:
System.Diagnostics.Process.Start("http://auspost.com.au/track/track.html?id=1234");
So in your button handler you could have something like this:
string trackingNumber = trackingTextBox.Text;
string trackingLink = string.Format("http://auspost.com.au/track/track.html?id={0}", trackingNumber);
// Launch browser to url
System.Diagnostics.Process.Start(trackingLink);
Assume that there is a web site which includes 3 different pages.
I want to show a text one of the pages randomly, with is formatted with css.
For instance the pages are below:
hello-world.aspx
hi-sun.aspx
good-night-moon.aspx
* When John enters to the site, the text will appear on hi-sun.aspx,
* When Elmander enters to the site, the text will appear on hello-world.aspx
And when one enters the page which includes a special text, even if come again, it shouldn't appear.
Psedue Code:
if(Session["first"] == "1")
{
//show the text in a random page
}
else
{
//text.visible = false
}
in the if block
how can I supply the text in a random page. (it shouldn't appear in every page, should appear only one page)
How can I do? Are there any suggestions?
Thank you.
I don't fully understand what you want to do, but I think it's something like this:
You have a couple of different sites (3), and you have a text (welcome or something) you only want to show once. But after typing in your url the user should see one of the sites randomly.
For the first (if you don't want the user to log in) you can either save some flag in the Session object or create a cookie for the user (saying he has seen the text) and check this every time you want to show it.
The session will on the server but will be lost so the user might see the same message later again if he revisits your site. But while staying he will see it only once.
The second is on the client. If he accepts the cookie he will never see the message again if not he might see it everytime because you cannot know. Maybe you want some combination of these both.
For the second you will have to send a redirect if you don't want to get fancy with a deep dive into System.Web.
In the case above you can just do:
if(Session["first"] == null)
{
Session["first"] = true;
//show the text in a random page
}
else
{
text.Visible = false
}
but note that the session will not stay forever for the current user.
I'm working on an application that connects to a serial port. I have experience in C#, but not so much in asp.net.
I have a Label on an aspx page which displays the status of the connection. When I click a button, a new page opens which let's you select the serial port you want to use. When you press the OK button on that page, it will send you back to the original page with the label.
Initially, the label says: "Status: Not connected". I'm saving this string in a globaldata class so I can access the string. I want that when you click the OK button on the new page, it will change the label to "Status: Connected", so when the original page loads the label will be changed.
So in the OK button I added onclick="butOK_Click" and then in the event I change the string in the globaldata class. However, I don't know how to get back to the page. Adding a PostBackUrl="Home/Index" (where Home/Index is the begin page with the label) does return to the begin page, but doesn't execute the code that changes the string.
How can I achieve what I want?
EDIT: now that I think about it, I only want to change the label after executing a function that actually connects to the serial port. I already have this function, it just needs to let the page know that it is connected.
Response.Redirect("~/Home/Index.aspx");
I need help with connecting to a certain website via my username & password.
With WebClient I can fill the username field and the password field, but how do I invoke the click method of the button?
And How can I fill a specific textBox that doesn't have an ID?
I tried doing this with webBrowser, but every time I navigate I have to use a new function every time, which makes the work much harder.
Thanks.
What you're trying to do is wrong. If you want to Post some data to a web address (a URL), simply create a web form (a simple HTML form), fill it, and then send it. Just consider these notes:
Your HTML's form action should be the exact URL of the form you're imitating.
Your input controls should have the same name attribute value.
For more information, see Form Spoofing
Look at the web browser control and see if you can use that inside your windows form to perform the task that you are doing. Once you are satisfied with the results, you can make the web browser control invisible, and it'll work just like you do with web response and request calls.
View the source code and find the id of the button (say "Login").
Then use:
HtmlElement elem = webBrowser1.Document.GetElementById("Login");
if (elem != null)
elem.InvokeMember("click");