|
No I didn't say you could not pass the web page. I am asking you to clarify why you need to pass the entire web page to the DLL in the first place. Can you please explain why you want to pass a web page to a DLL.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
Sorry. Wanted the web page so we can take advantage of all the methods, etc. available. Updating of various status fields and perhaps responses (if we could figure out how).
Since Asp Net is new to us and we are converting from Desktop to Web we need to be able to learn as well as get the job done. We are already behind in the project.
One of the major problems is how to do the desktop equivalent of MsgBox (MessageBox.show) and get the results in the middle or processing e.g.
importing a file that has been running for a few minutes as record 500 of 1000 just to find there is some type of problem as in the data, etc.
In the Desktop app we would put something like
RetB = MsgBox("Hit Yes to continue as is, No to Skip, Cancel to abort", VBYesNoCancel).
if Retb = VBVancel then
GoTo ExitFunction
ElseIf Retb = VBYes then
ElseIf RetB = VBNo then
Endif
The program execution stops and then resumes when the user hits Yes, no or cancel.
This is not that easy in a Web app and currently not even sure how to do it. Certainly do not want a postback to come back in and we have to start all over or loss the variables, etc.
Any ideas would be appreciated.
Thanks and have a Great 2015!
|
|
|
|
|
I understand your need to get something working quickly, but equally you don't want to make bigger problems for yourselves further down the road. By passing the web page to your DLL you are creating a dependency which will make future development and maintenance difficult to say the least.
Firstly I would move all the code that is currently embedded in your web page to a separate class that can be invoked by your web page or any other class that requires it. This removes any dependency and gives you more flexibility going forwards.
There are many different ways in which to display messageboxes on a web page. You'll need a basic grasp of javascript. Here's just example of how it can be accomplished http://www.aspsnippets.com/Articles/Display-MessageBox-in-ASP.Net-using-JavaScript.aspx[^]
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
The main pages are C#. I have not been able to convert it to VB (our main language). Gave up on it. Was always getting some type of load problem on startup. I do not remember the details.
Most of the samples for MsgBox(MessageBox.Show) only display and do not discuss in detail the main points.
1. Getting a response i.e. Yes, No, Cancel back to the invoking code.
2. This has to suspend the invoking code and not do any type of postback since the process might have been running for many minutes and do not want to restart and loose memory variables and other objects which can be time consuming. It is not clear how to preserve these variables and objects if any type of postback is to be done.
The idea was to make the web app run as the desktop app.
1. Status of where we are in the process i.e. Record #, name, etc.
2. Ability to do a MsgBox to ask user in case of problems as to what to do.
I guess that we could retry to convert or re-code the C# pages to VB again if that is the best approach.
|
|
|
|
|
Consider this. The .dll exists on the server. Even if you did have a msgbox, that code is not running on the client - client would never see this msgbox.
Why not instantiate the class in code-behind of the webpage and access methods that way. It makes no matter that it is a vb.net class. The class methods will need to return results that can then be used to render on the page as necessary.
MsgBox in server code for website can cause much grief.
There are strangers on the Plain, Croaker
|
|
|
|
|
I understand that MsgBox is a Server type of function and would not work which is why I am looking for a replacement.
I do see that there are various 'push' techniques to push data to a web page without the user doing anything like in streaming or a chat box. Surely something can be done that is similar. Somehow to keep the connection open and keep sending responses.
The VB class works now and to move the function calls to the main C# page handler would take a long time. Or perhaps I do not understand what you mean.
|
|
|
|
|
Still i cant send email .will someone help? does any change require for smtp?
when i click the button it does nt send the mail..
will someone help me to get mail..
i have changed the sender email and password here.
my code on button click
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Net.Mail;
namespace sms2
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SendMail()
{
var fromAddress = "net@gmail.com";
var toAddress = YourEmail.Text.ToString();
const string fromPassword = "12345";
string subject = YourSubject.Text.ToString();
string body = "From: " + YourName.Text + "\n";
body += "Email: " + YourEmail.Text + "\n";
body += "Subject: " + YourSubject.Text + "\n";
body += "Question: \n" + Comments.Text + "\n";
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
smtp.Port = 2525;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new System.Net.NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 20000;
}
smtp.Send(fromAddress, toAddress, subject, body);
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
SendMail();
DisplayMessage.Text = "Your Comments after sending the mail";
DisplayMessage.Visible = true;
YourSubject.Text = "";
YourEmail.Text = "";
YourName.Text = "";
Comments.Text = "";
}
catch (Exception) { }
}
}
}
|
|
|
|
|
Gmail uses port 587. Also, are the from address and password correct? You need to provide full details of the error that occurs in your SendMail method.
|
|
|
|
|
vao, its done but i received an email that is following
We recently blocked a sign-in attempt to your Google Account [mailinternet@gmail.com].
Sign in attempt details
Date & Time: Sunday, December 28, 2014
Location: jhgfgyugfuy
If this wasn't you
Please review your Account Activity page at https://security.google.com/settings/security/activity to see if anything looks suspicious. Whoever tried to sign in to your account knows your password; we recommend that you change it right away.
If this was you
You can switch to an app made by Google such as Gmail to access your account (recommended) or change your settings at https://www.google.com/settings/security/lesssecureapps so that your account is no longer protected by modern security standards.
when i clicked the second link and enable this lesssecureapps then i received email properly. but my last question is that will it destroy the security of my email account which i will use ? thaks alot bro
|
|
|
|
|
Member 11336034 wrote: will it destroy the security of my email account which i will use ? No idea, you need to ask Google.
|
|
|
|
|
i am facing the NetworkCredential problem which is given below.
1 The type or namespace name 'NetworkCredential' could not be found (are you missing a using directive or an assembly reference?)
My code is
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
namespace sms2
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SendMail()
{
// Gmail Address from where you send the mail
var fromAddress = "Gmail@gmail.com";
// any address where the email will be sending
var toAddress = YourEmail.Text.ToString();
//Password of your gmail address
const string fromPassword = "Password";
// Passing the values and make a email formate to display
string subject = YourSubject.Text.ToString();
string body = "From: " + YourName.Text + "\n";
body += "Email: " + YourEmail.Text + "\n";
body += "Subject: " + YourSubject.Text + "\n";
body += "Question: \n" + Comments.Text + "\n";
// smtp settings
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
// smtp.Port = 587;
smtp.Port = 2525;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
// request.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 20000;
}
// Passing values to smtp object
smtp.Send(fromAddress, toAddress, subject, body);
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
//here on button click what will done
SendMail();
DisplayMessage.Text = "Your Comments after sending the mail";
DisplayMessage.Visible = true;
YourSubject.Text = "";
YourEmail.Text = "";
YourName.Text = "";
Comments.Text = "";
}
catch (Exception) { }
}
}
}
|
|
|
|
|
Try either defining
using System.Net;
or
fully qualified definition
smtp.Credentials = new System.Net.NetworkCredential(...
And of course ensure that you have referenced the necessary assembly (System.Net.Primitives.dll)
|
|
|
|
|
|
The answer above from Mika is correct; however, another option is to just hover over the little line that shows up on your code. Then you can click the smart tooltip and it will show you what to do, in this case there should have been a "using System.Net" option likely.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
Hi everyone,
I already develop application booking room system, and now I want user can use OWA to access and booking room.
could everyone help me how to I can check user login OWA success or not. if success will redirect to other side if not return login form.
I using Exchange 2007 server.
thank you.
trtreterte
|
|
|
|
|
|
How can to change the properties of a control in the page?
|
|
|
|
|
Please do not repost.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
How can to change the properties of a control in another page?
|
|
|
|
|
You'll need to get an instance of the control and then you'll have access to any properties it exposes.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Create an object and use that instance so that u will get all the properties of that control which u created an object.
Your help is much appreciated.
Thanks
Happy Coding!
|
|
|
|
|
Hello Experts,
I have a web page that takes lot of data from users. I want that to be stored in Database. So this is taking some time.
1) How can I fetch the data from webpage and store in Database (MySQL)? Don't say Dim FirstName as String=txtFN.Text.Tostring(). I know that, but should I Use those many string variables? I almost have 50+ controls that need to saved in Database on Submit button click. what are other options for this?
2)Meanwhile, I want all the controls of the page Editable=False. It means it should show a Progress which stops the user from clicking on page here and there. I have done progress bar in Windows application 2 days back from the guidance given by experts in this Forum. Now its time to do in Web application. Please suggest me how do proceed
Your help is much appreciated.
Thanks
Happy Coding!
modified 23-Dec-14 13:15pm.
|
|
|
|
|
If you want to block input, then you can either disable all the textboxes or input elements
Or use a Modal Overlay, sort of a shield that lays over the page and is colored.
This is simple modal, it uses jquery to create a modal overlay, and what ever else you want in the center like a spinning gif image.
http://www.ericmmartin.com/projects/simplemodal/[^]
Or you can use the update panel in asp.net, in conjunction with the update progress.
http://msdn.microsoft.com/en-us/library/bb386421%28v=vs.140%29.aspx[^]
None of them are very straight forward and easy to implement. It took me years to really understand how they work and how to fully customize them. But the latter would be easier for you if your not able to write javascript or jquery.
But to start, you really need a vision of how you want it to look first, and how it should respond.
On the other question, how to transfer the data to the server, I'm not touching that one.
It's the HTTP Protocol, and works one way. All the input elements have to be posted back to the server, and you have to catch the values on the server side. So that's 50 values for you.
|
|
|
|
|
Ok, I found a way to do progress bar, but my GIF images are showing as little Cross mark on ASPX page when I Run the Code. Do you know how can I get rid of Cross mark and get my progress bar work?
Your help is much appreciated.
Thanks
Happy Coding!
|
|
|
|