C# - Get The User's IP Address In Castle MVC (Monorail)?
Apr 26, 2010
In a controller action of a CastleMVC application, how can I get the user's IP Address?
I think in asp.net mvc it would be Request.ServerVariables["REMOTE_ADDR"], but I can't find an equivalent in Castle.
(I am aware of potential proxy issue's etc, the address that is reported in the request is fine)
View 2 Replies
Similar Messages:
Jul 21, 2010
Is it possible to use the Microsoft (or Mono) supplied System.Web.Routing instead of the MonoRail routing stuff when building a Castle MonoRail app for ASP.NET?
View 1 Replies
Jan 28, 2011
I'm modifying a Castle-Monorail site that I've inherited and found that it would be useful to see a list of currently online users. Currently there are Filters that determine who can access which parts of the site so I can distinguish logged in sessions from non-logged in sessions. Is there an easy way of getting a list of active sessions so that I could then work out who is logged in?
View 1 Replies
Jan 24, 2016
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
[Code] ....
View 1 Replies
Feb 8, 2010
I'm trying to set up IoC (Castle Windsor) in my MVC 2 project here, using the section in Pro Asp.net MVC Framework book.
However, I cannot compile after creating a custom controller factory as stated in the book.
This part give me error:[Code]....
Telling me that no suitable method have been found to override?
Does someone know if there's a problem with the code in the book or something changed with recent versions of things (wont suprise me..got some books on MVC here rendered completely useless with the evolution of asp.net mvc)
View 12 Replies
Mar 9, 2010
Recently, I've had some problems with StructureMap. Mostly incomplete documentation, but also they have a habit of drastically changing namespacing, object names, removing methods, and generally changing how the thing works.For now, my code is written using poor man's DI so that I can keep working on it, but I don't want to leave it that way. I took a look at Castle Windsor a while back, but never really tackled it.
With StructureMap, I would derive a custom Registry class where all the mapping is done, a custom Bootstrap class which loads one or more registry classes and initializes them, and then, call Configure on the bootstrap class in Global.asax.How does one go about setting up the matching Castle code? I also need to know how the controller factory is affected. Does Castle provide a replacement, or are we left to write our own, as with StructureMap
View 11 Replies
Mar 23, 2010
I'm trying to use Castle ActiveRecord with c#.
I'm moving data from an old database (FF2) to spatiaLite (sqLite)
The first few tables are updated without any problems. Then every table after gives and error
when I try to save. None of these tables have composite primary IDs.
SnapFarms tbl = new SnapFarms();
.... loop
if (theField.Equals("clientid")) tbl.operationId = getString(val, "{000-000}"); else
if (theField.Equals("farmid")) tbl.farmId = getString(val,"{000-000}"); else
if (theField.Equals("farmname")) tbl.farmName = getString(val,"Missing"); else ...
... end loop
tbl.Save();
exception message::Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
There is no Index column so what is going on?
View 4 Replies
Feb 8, 2011
I have read about not being able to use a .NET Custom Membership with Castle Windor. Is this the case? Are there any work arounds?
View 1 Replies
Aug 5, 2010
Possible Duplicate:
How to get visitor location ( country, state and city ) using ASP.NET
How get user location using user IP address using asp.net?
View 1 Replies
Aug 27, 2010
I am getting the following error in an Asp.Net Castle ActiveRecord app when trying to update an object:
"a different object with the same identifier value was already associated with the session"
I've looked up and down my code to see where else the object might have been created but I'm not seeing it. This is baffling as I have the exact same code on another page that works fine on updates
Now I'm thinking of trying to see where this other object is in the Session and either kill it or find out how it got into the session. How can I find this object?
[Update]
Ok, I finally found where the object is being called. However, I would still like to know how to find objects in the session for future reference.
View 1 Replies
Jun 1, 2010
I want to capture user ip address but some reason i am getting different values:
method 1:
Dim strHostName As String = System.Net.Dns.GetHostName()
Dim clientIPAddress As String = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString()
method 2:
Dim k As String = Request.ServerVariables("remote_addr")
View 9 Replies
Sep 10, 2010
I am trying to fetch the IP address using this:-
protected void Page_Load(object sender, EventArgs e)
{
string ClientIP;
ClientIP = HttpContext.Current.Request.UserHostAddress;
Label1.Text = ClientIP;
}
This code outputs 127.0.0.1.
And the code below displays nothing!
string ClientIP;
ClientIP = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
Label1.Text = ClientIP;
How do I fetch the IP address? The REAL IP address of a user?
[EDIT]
I don't want EXACT location BTW. I need to know the country and then redirect the user to a webpage accordingly.
View 2 Replies
Jun 7, 2010
I used following methods
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]
Request.ServerVariables["REMOTE_HOST"]
Request.UserHostAddress
Request.UserHostName
All the above are returning "127.0.0.1", not the actual IP.
The below one returns null.
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]
Below one always returns where the application is hosted/running, not the client's IP address.
string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
View 14 Replies
Dec 1, 2010
I have site ( ASP.NET, C# ) and I need to automatic show start page based on user location. Can I get name of user city if I have IP address of user ?
View 5 Replies
Mar 16, 2011
which property should be used to get the ip address of a connected useruse property
View 3 Replies
Mar 3, 2010
I have a data list on my page which shows a clients company, address and contact info. This information is stored in a sql database table. one of the columns is email address
Also on the page is a button and textbox set to multimode where the logged on client can send a message.
In the the button click event I want to send the message but capture the email address from the "Email" column and add this to the from part of the mail message as below
[Code]....
I just want to get the email address this way or get it from the membership system which ever is better.
View 1 Replies
Nov 23, 2010
This is the current architechture and this is the question I have: Current architechture: We have an intranet application. No one accesses from outside the firewall. It's pretty simple architechture. We have a webservice and WebUI. The Web UI calls the webmethods of the webservice. So far so good. It works fine. Both webservice and WebUI runs under the context of the same service account (non human user account) that we created. The security is a role based security. If a user is a specific AD group, he can access with web UI. On the webui and webservice we have "Integrated windows authentication".
Code:
<authorization>
<allow roles="MycompanyApr-DataWriters"/>
</authorization>
So all the users and the service account that runs this webservice are in this AD group Apr-DataWriters. When a user launches this webUI, I want to find out either his box number of IP address of this box and datetime stamp. How can i get that information.
View 5 Replies
Sep 29, 2010
I have tried fetching the ip from below mentioned methods
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] &
Request.UserHostAddress & Request.ServerVariables["REMOTE_ADDR"]
View 2 Replies
Oct 11, 2010
We are using Profile.FirstName and Profile.LastName to get current user's firstname/last name. How do we get current user's email address?
View 2 Replies
Jan 24, 2016
There is a post request coming to my portal and I am fetching IP address from the post request on my portal landing page(INDEX view in MVC) and saving in DB table. below is the code to fetch IP address.
string Device_IP = "";
if (!string.IsNullOrEmpty(Request.ServerVariables["HTTP_VIA"]))
{
// ' using proxy
// ' Return real client IP.
[CODE] ...
It is fetching IP address on my side but on client side when request is made code is not working. same code working fine on other sites.
View 1 Replies
May 7, 2015
I want save users IP in database
View 1 Replies
Mar 18, 2010
How to retrieve the current authenticated logged in user's email address who is accessing the page.
I have managed to do it with users. How to get the current authenticated user's email address if that makes sense.
Here is my aspx code:
[Code]....
and my VB script:
[Code]....
Somebody suggested that I should run a query. If you know the user name accessing the page, surely you can take that information, insert it into a query to find out the email address of the user accessing the page. Sounds great but don't have a clue how to do it.
View 2 Replies
Jan 19, 2010
Is it possible for a user to recover their password by entering their e-mail address alone?
Right now I am using the PasswordRecovery control, and i have security questions disabled. So all the user has to do is put their User Name, and hit submit, then their password is e-mailed to them.
But, a lot of my users forget their User Name, so right below I have a User Name recover section. The user inputs their e-mail address, and their corresponding user name shows up.
I would like to simplify this and just require the user's e-mail address to provide them their user name AND password.
View 3 Replies
Apr 3, 2010
I have been searching since some days for the best approach one can have in order to allow an authenticated user to change his/her email address.
This is the code I have but apparently it doesn't work and it doesnt even gives a error. The application seems to ignore it:
Change email address:
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox><br />
<asp:Button ID="changemailbtn" runat="server" Text="Button" />
<asp:Label ID="lblErrors" runat="server" EnableViewState="False"
[Code]....
View 8 Replies
Jul 6, 2010
I need to validate IP Address which is entering into textbox by the user....
I validated some other controls using ajax only, so only expecting the same for IP Address also...
View 7 Replies