|
Hi people,
I want to track what IP's/MAC addresses connect to my web application - but I am having troubles getting the IP of the connecting client.
Every variable or method I try - I seem to end up getting the IP of the server or of the internet provider of the client computer!
Has anyone come across this problem before and come up with a definite solution? I have tried many alternatives that I found via google - but none seem to work
Any help would be MUCH appreciated!
Thanks in advance.
Xav
|
|
|
|
|
|
There is no solution. The last step is a router which implements NAT, and forms the separation between the private address space (typically 192.168/16), and the internet. No IP information will cross that barrier.
If you're thinking of getting MAC addresses, it's even worse: the only address you'll ever see is the one of YOUR router. MAC addresses are a layer 2 thing (Media Access Control Layer), and routers operate on Layer 3 (Internet Layer) No Layer 2 information will ever cross a router.
|
|
|
|
|
I have install sucessfully AJAX Extesion & Ajax ControlToolKit for ASP.NET 2.0; AjaxControlToolKit is instaled by proper way(D:\web_prg\ControlToolKit2.0\SampleWebSite\Bin\AjaxControlToolKit.dll) that is provided with the SetUp(.exe) for AjaxControlKit.
Element 'HoverMenuExtender' is not a known element. This can occur if there is a compilation error in the Web site.
ScriptManager1:Unknown server tag 'asp:ScriptManager'.
why these errors are Occurs.
|
|
|
|
|
you have to register the assembly in the header like
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
Check the Assembly and Namespace according to your application
|
|
|
|
|
I have already register this Assembly in Header.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MultipleSelection.ascx.cs" Inherits="MultipleSelection" %>
<%@ Register Assembly="CheckBoxListExCtrl" Namespace="CheckBoxListExCtrl" TagPrefix="cc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2" %
|
|
|
|
|
Refresh the Ajax control Toolbox. and add the AjaxControlToolkit.dll again.
|
|
|
|
|
Hi friends!
I am very new to Ajax. I want to use ajax in my website for making intrective;During Ajax I faced some problem ;Plz give me right direction.
Problem:
I have used the Login Control for Authenticatin.My Authentication function is working well; But for authentication full webpage is going to Refresh.
I want to authenticate but without the full webpage refresh. Means by using the Ajax authentication should be done without full webpage refresh.
Code:
ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table bordercolor="#990000">
<tr>
<td bgcolor="#990000" colspan="4" style="height: 12px">
<span style="font-size: 11pt; font-family: Tahoma"><strong> <span style="font-size: 10pt"><span
style="color: #ffffff">Utility<span> Login</span></span></span></strong></span></td>
</tr>
<tr>
<td style="width: 79px; height: 29px">
<span style="font-size: 10pt; font-family: Verdana">User ID</span></td>
<td style="width: 92px; height: 29px">
<asp:TextBox ID="txtuid" runat="server" Height="15px" Width="100px"></asp:TextBox></td>
<td colspan="2" style="width: 3px; height: 29px">
<asp:Label ID="Label3" runat="server" ForeColor="Red" Text="*" Visible="False"></asp:Label></td>
</tr>
<tr style="font-size: 10pt; color: #000000; font-family: Verdana">
<td style="width: 79px">
<span><span>Password</span></span></td>
<td style="width: 92px">
<asp:TextBox ID="txtpassword" runat="server" Height="15px" MaxLength="15" TextMode="Password"
Width="100px"></asp:TextBox></td>
<td colspan="2" style="width: 3px">
<asp:Label ID="Label4" runat="server" ForeColor="Red" Text="*" Visible="False"></asp:Label></td>
</tr>
<tr>
<td style="width: 79px; height: 19px">
</td>
<td style="width: 92px; height: 19px">
<asp:Button ID="Button1" runat="server" Text="Sign In" OnClick="Button1_Click1" />
<asp:Label ID="Label1" runat="server" Text="Label" Visible="False"></asp:Label></td>
<td colspan="2" style="width: 3px; height: 19px">
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel><pre>
|
|
|
|
|
kushMuchaal wrote: I have used the Login Control for Authenticatin
Where is your login control?
|
|
|
|
|
arun$aini wrote: Where is your login control?
Probably all that stuff we call html and server control tags, like textbox and button.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I thought he was talking about the asp.net login control.
|
|
|
|
|
So what issues/problems are you having? IMO login should not be done via ajax. The initial page should display only publicly accessible information, after authentication the user should be redirected to secured content.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks for gving interest in my problem;
Language: C# with Asp.net using AJAX
After using the update panel including authentication Table(userName,Password)the following error occur; Wats the reason for this Error;
Sys.WebForm.PageRequestManagerParserErrorException:THis msg recieved from the server could not
be parsed.Common cause for this error are when the response is modified by calls to Response.Write(),
response filters,HttpModules.or server trace is Enabled.
Details:Erro parsing near' |<html> <Head> '.
|
|
|
|
|
Have you made sure the httpmodules for ajax have been added to the web.config?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yes Sir I have already Added to the webconfig.
|
|
|
|
|
I'd go with my original response, you are gaining nothing in the login process by trying to use AJAX.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
What code you have written on Button1_Click1 event?
|
|
|
|
|
I have used this code;
protected void Button1_Click1(object sender, EventArgs e)
{
string str = "select * from userlogin where userid='" + this.txtuid.Text + "' and password='" + this.txtpassword.Text + "'";
OracleDataReader dr = dms_obj.GetDataReader(str);
if (dr.Read())
{
Session["username"] = txtuid.Text;
string sess = Convert.ToString(Session["username"]);
Session["password"] = txtpassword.Text;
string pass = Session["password"].ToString();
Label1.Visible = true;
Label1.Text = "Authentication Success";
txtuid.Text = "";
txtpassword.Text = "";
}
else
{
Label1.Text = "InValid UserName/Password";
txtuid.Text = "";
txtpassword.Text = "";
}
}
|
|
|
|
|
string str = "select * from userlogin where userid='" + this.txtuid.Text + "' and password='" + this.txtpassword.Text + "'";
Unvalidated user input placed directly into inline SQL? What's the point of having a login? Have you ever heard of SQL Injection attacks?
Session["password"] = txtpassword.Text;
NEVER, EVER store a password in memory!!
Session["username"] = txtuid.Text;
string sess = Convert.ToString(Session["username"]);
Session["password"] = txtpassword.Text;
string pass = Session["password"].ToString();
This is useless code. Put the text to Session variable then the Session variable to a local variable. You don't even use the local variables.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hi iam using asp.net with c#
i want to display an default image from my website folder when there is no image in database , can you correct my code
<%@ WebHandler Language="C#" Class="left1" %>
using System;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web;
public class left1 : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string branchid = "";
if(context.Session["branchid"]!=null)
branchid= context.Session["branchid"].ToString();
else
throw new ArgumentException("No parameter specified");
context.Response.ContentType = "image/jpeg";
Stream strm = ShowImage(branchid);
byte[] buffer = new byte[4096];
int byteSeq = strm.Read(buffer, 0, 4096);
while (byteSeq > 0)
{
context.Response.OutputStream.Write(buffer, 0, byteSeq);
byteSeq = strm.Read(buffer, 0, 4096);
}
}
public Stream ShowImage(string branchid)
{
SqlConnection con = new SqlConnection(" Data Source=.; Initial Catalog=SafaView;User ID=sa;Password=nsg_ss_0103;");
string sql = "SELECT imgleft1 FROM tblImages WHERE BranchId = @BranchId";
SqlCommand cmd = new SqlCommand(sql, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@BranchId", branchid);
con.Open();
object img = cmd.ExecuteScalar();
try
{
return new MemoryStream((byte[])img);
}
catch
{
return null;
}
finally
{
con.Close();
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
in page load
=========
string id = "";
protected void Page_Load(object sender, EventArgs e)
{
id= Session["branchid"].ToString();
if (IsPostBack == false)
{
Image1.ImageUrl = "left1.ashx?BranchId="+id;
Image2.ImageUrl = "left1old.ashx?BranchId="+id;
}
i want to display a default image when there is no image in database
can you correct my code
|
|
|
|
|
My assumptions -
* Default image is also in the database
* BranchId is numeric
* Default image has the least possible BranchId say 0
Alter the query like so -
SELECT top 1 imgleft1 FROM tblImages WHERE BranchId in (@BranchId, @Default) order by BranchId desc
Add this line to the code
cmd.Parameters.AddWithValue("@Default", 0);
Now if the BranchId is available then that image would be displayed, else the default image would be displayed.
HTH!
|
|
|
|
|
Hello All,
I have a Web Application I am developing that has a GridView.
I have searched the internet to no avail looking for an answer to this.
The gridview has 11 columns. I want to hide the 11th column while in normal mode and make visible while in edit mode.
Here is my Code:
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowState = DataControlRowState.Edit Then
GridView1.Columns(11).Visible = True
ElseIf e.Row.RowState = DataControlRowState.Normal Then
GridView1.Columns(11).Visible = False
End If
End Sub
My result from the above code is The 11th column is not visible in Normal mode but when I click the Edit button an error StackOverflowExceptionwasunhandled comes up.
What am I missing
Thanks!
Tommy
|
|
|
|
|
if your column is 11 in grid view than u need to hide 10 one because in grid column start from 0 as base index
so you code may be
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowState = DataControlRowState.Edit Then
GridView1.Columns(10).Visible = True
ElseIf e.Row.RowState = DataControlRowState.Normal Then
GridView1.Columns(10).Visible = False
End If
End Sub
For more help : pranayamr@gmail.com
|
|
|
|
|
Pranay,
I did take that in to account to be sure I did change to 10 see the result.
Its was the same but just on the 10th column.
I still get the StackOverflowExceptionwasunhandled
As if its looping but I don't understand why.
Thanks,
|
|
|
|
|