|
|
I want to redirect to Home.aspx page but I am getting this error message:"System.Web.HttpException: Response is not available in this context" in the line of Response.Redirect("Home.aspx"); Any idea on solving this?
if ((strbuffer[11].ToString() == strCard1[11]))
{
UserID = "0000";
Send_Beep();
System.Diagnostics.Debug.WriteLine(("UserId: " + UserID));
comRFID.Close();
Response.Redirect("Home.aspx");
}
else
{
Response.Write("<script>alert('Card Undefined, Please Register Your Card.');</script>");
}
modified 20-Feb-17 8:58am.
|
|
|
|
|
We need to see the context. Where is this code being called from?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi, this is my aspx.cs file:
private void comRFID_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
System.Diagnostics.Debug.WriteLine("comRFID_DataReceived");
comRFID.Read(hex, 0, hex.Length);
//Send_Beep();
System.Diagnostics.Debug.WriteLine("hex[0].ToString()");
System.Diagnostics.Debug.WriteLine("hex[1].ToString()");
System.Diagnostics.Debug.WriteLine("hex[2].ToString()");
System.Diagnostics.Debug.WriteLine("hex[3].ToString()");
System.Diagnostics.Debug.WriteLine("hex[4].ToString()");
System.Diagnostics.Debug.WriteLine("hex[5].ToString()");
System.Diagnostics.Debug.WriteLine("hex[6].ToString()");
System.Diagnostics.Debug.WriteLine("hex[7].ToString()");
System.Diagnostics.Debug.WriteLine("hex[8].ToString()");
System.Diagnostics.Debug.WriteLine("hex[9].ToString()");
System.Diagnostics.Debug.WriteLine("hex[10].ToString()");
System.Diagnostics.Debug.WriteLine("hex[11].ToString()");
string[] strCard1 = { "2", "12", "18", "128", "4", "0", "149", "124", "243", "50", "224", "243" };
//byte[] bytes = { hex[0], hex[1], hex[2], hex[3], hex[4], hex[5], hex[6], hex[7], hex[8], hex[9], hex[10], hex[11] };
string[] strbuffer = { hex[0].ToString(), hex[1].ToString(), hex[2].ToString(), hex[3].ToString(), hex[4].ToString(), hex[5].ToString(), hex[6].ToString(), hex[7].ToString(), hex[8].ToString(), hex[9].ToString(), hex[10].ToString(), hex[11].ToString() };
if ((strbuffer[11].ToString() == strCard1[11]))
{
UserID = "0000";
Send_Beep();
System.Diagnostics.Debug.WriteLine(("UserId: " + UserID));
comRFID.Close();
Response.Redirect("Home.aspx");
//Server.Execute("Home.aspx");
//HttpContext.Current.Response.Redirect("Home.aspx");
//Server.Transfer("Home.aspx", true);
}
else
{
Response.Write("alert('Card Undefined, Please Register Your Card.');");
Send_cmd();
}
modified 20-Feb-17 22:40pm.
|
|
|
|
|
So based on the name, that method is being called when data has been received from a serial port on the server - potentially some time after the page has finished executing and returned the response to the user.
The user is not still connected to the page, and there is no "response" to alter.
You need to read up on how ASP.NET works:
Understanding ASP.NET Application and Page Life Cycle - A Beginner's Tutorial[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello,
I'm building a web application which involves using Google Translation.
The goal is to have the user enter the text into a text-box on my form, and then my code should take that string and enter it into Google Translate and retrieve translation. Any ideas how I can do that? Google Translator doesn't affect URL in any way when a query is entered or when a result is returned. It's completely in-page and URL independent, so I can't do anything there.
Any ideas?? I'm using VB.NEt
Thanks
|
|
|
|
|
Most likely you need to use an API or service provided by Google. Go to the Google developers website and see what features are available.
|
|
|
|
|
|
how could I scroll image for vb 2010?
|
|
|
|
|
|
increment a file path if already exists using mediafire,conversion options and mega data while saving a video in c#
|
|
|
|
|
That's a better subject-line than cross-posted version in the C# forum. Alas, this one is missing the code-dump and will look cryptic.
Please don't cross-post.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
hello..i am a computer science student and this is my final year and i am developing a website for my semester project.in my developing website i am going to implement one live chat session same as like facebook chat using asp.net..i have searched for the code for a lot of times but i didn't get any valid code.so,can you please respond to my problem?i need one live chat session code for asp.net website..please help me... 
|
|
|
|
|
Member 12942419 wrote: have searched for the code for a lot of times but i didn't get any valid code. And that's the problem...
You are a student, which means you are learning and need to practice. If you search for code "ready to go solutions" you are never going to learn as you should.
Facebook has a lot of very good professional programmers. Don't you think, this might be a bit too much for your level?
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
How is your project any reflection of your ability if you simply get the code elsewhere? If you get a job as a programmer and they want you to develop a hotel booking website what are you going to do? Search the net for hotel booking code? What if you can't find any or it doesn't meet client requirements?
No-one here is going to help you cheat your way to a qualification as we might end up working next to you one day.
|
|
|
|
|
Member 12942419 wrote: i have searched for the code for a lot of times but i didn't get any valid code I'm not sure what you are searching for but there are tons of examples online of how to do chatting using ASP.Net. You won't find anything you can copy and paste and be done with and I'm sure you wouldn't want that anyway.
So, get started writing the code. If you ever want a job programming you'll never be able to copy and paste entire projects of code off the internet. So, learn. Do.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi All,
I use Visual Studio 2010 to develop a Web Form Application and use the DevExpress Controls in this application, my problem is when I open the design view of a page called index2.aspx which contains many controls it takes a long time ti view the design and the html code repeated and duplicated.
Example: if I have a break line tag
<br/> in index2.aspx it is duplicated to many lines like this
<br/>
<br/>
<br/>
Please let me know how to solve this issue.
Thank You All
|
|
|
|
|
I didnt find any AngularJS example which works with Asp.net web app. Please provide a link / Example
|
|
|
|
|
|
Sorry Richard, please make it is clear.
|
|
|
|
|
|
Are you talking about WebForms (because there is also ASP.NET MVC)?
Don't use Angular with WebForms; that's just dumb. They do the exact same thing, except one renders on the client and the other renders on the server.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Yes Nathan, I am talking about plane asp.net web forms not Asp.net MVC.
|
|
|
|
|
Then the rest of my post applies.
Don't do it. It's a bad idea. Switch to MVC/WebAPI/Nancy/Whatever or stick with WebForms(if you must), but do not entangle your data-binding and presentation between WebForms and Angular. That's a recipe for high technical debt, mind-numbing complexity, and long-term disaster.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Greetings all
I am sure I am doing something wrong here.
We have a dropdownlist that has three values, Today, Yesterday and ALL.
There is always a record for today and All.
However, there are times when yesterday falls on Weekends and in some cases, there are no record created for that particular weekend.
In situations such as that, we would like a message to user that there are no records from yesterday.
Does anyone have any ideas why this code is not displaying that message?
Private Sub Bindgrid()
Dim s As String = ""
Dim reportType = ddlrpttype.SelectedValue
conn.Open()
If reportType = "Today" Then
s = "SELECT * from mytble WHERE (DATEDIFF(day,CONVERT(datetime,work_request.date, 121),GETDATE()) = 0 ) "
ElseIf reportType = "Yesterday" Then
s = "SELECT * FROM mytble WHERE (DateDiff(Day, Convert(DateTime, work_request.date, 121), GETDATE()) = 1 )"
ElseIf reportType = "All" Then
s = "select * from mytble"
Else
lblmsg.Text = "No record found from yesterday.")
End If
'Response.Write(s)
'Response.End()
Dim cmd As New SqlCommand(s, conn)
Dim dr As SqlDataReader = cmd.ExecuteReader()
reportgrv.DataSource = dr
reportgrv.DataBind()
conn.Close()
End Sub
|
|
|
|