|
Try This
string ip;
ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR");
if(ip==string.Empty)
{
ip=Request.ServerVariables("REMOTE_ADDR");
}
If It Helps Click It as Answer
|
|
|
|
|
This works fine..
string hostName = System.Net.Dns.GetHostName();
string clientIP = System.Net.Dns.GetHostAddresses(hostName).GetValue(0).ToString();
Response.Write(clientIP);
|
|
|
|
|
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name="AuthorizationApp">
<service>
<wellknown mode="SingleCall"
type="Server.SampleService, Server"
objectUri="Server.rem"/>
</service>
<channels>
<channel ref="tcp" port="8001" secure="true" impersonate="true" authorizationModule="Server.AuthorizationModule,Server"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>
how to set the properties "impersonation" and "authorizationModule" inside my program .. im not using the configuration files.
|
|
|
|
|
It's an XML document, so you could presumably use an XmlDocument, and the DOM.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
This has nothing to do with ASP.NET
only two letters away from being an asset
|
|
|
|
|
|
Hi, I have aready seen this .. but didn't post it here.. thanks for doing it
I got my answer on this link only.
I am putting my code for others reference
static void Main(string[] args)
{
//TcpChannel channel = new TcpChannel(8080);
IDictionary props = (IDictionary) new Hashtable();
props.Add("port", "8080");
props.Add("secure", "true");
//props.Add("impersonate", "true");
//props.Add("authorizationModule", "AuthorizeUser");
BinaryClientFormatterSinkProvider cp = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider sp = new BinaryServerFormatterSinkProvider();
IChannel chan = new TcpChannel(props,cp,sp);
ChannelServices.RegisterChannel(chan,true);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(ns_registeruser.cls_registeruser), "ApplicationMain", WellKnownObjectMode.Singleton);
Console.WriteLine("Server Started .. ");
Console.ReadLine();
|
|
|
|
|
|
Hi,
Is there a reason one would prefere Request.Form instead of the UpdateModel(..)?
Another question:
If one haves a class (generated by linq to sql) with two properties like:
SomethingId,
Something
Being SomethingId an int and Something the object,
For example:
Table Messages {...,FromId, ..}
is mapped to
Class Message {...,FromId, From, ...}
Being From an object of lets say type User
So, my question is how is the procedure to edit these kind of objects if I'm using Request.Form?
Between A and B:
Way A:
1. Retrieve the object obj being edited from the repository, obj = objsRepository.RetrieveById(..)
2. x = Request.Form["SomethingId"]
3. obj.SomethingId = x
vs
Way B:
1. Retrieve the object obj being edited from the repository, obj = objsRepository.RetrieveById(..)
2. x = Request.Form["SomethingId"]
3. xAsObject = somethingsRepository.RetrieveById(x)
4. obj.Something = xAsObject
Which one is the correct way ??
(Of course in my form I wont have "objects".. just strings)
|
|
|
|
|
Hi
I have a project, which is a WCF Web Service, which I want to use, but when I go to add this service to my Consumer Project by right clicking on the solution and selecting Add Service Reference, I am unable to see it. Selecting discover and typing in a URL hasn't helped either. I know must be missing some step out along the way. Can someone please explain to me how I can reference my service so I can use it?
Thanks
|
|
|
|
|
Hi,
Does the URL work on Internet Explorer?
If yes, can you see the wsdl schema?
|
|
|
|
|
No the url does not work, but I could have this wrong and no I cannot see the wsdl.
|
|
|
|
|
What is the error when you try to access through Internet Explorer?
|
|
|
|
|
I am creating a simple remoting application which uses a strongly typed data set to retrieve data and send it to the cliet when required.
This works fine when I have everything installed on my machine. Now I am trying to deploy the sever on a machine on my network ... but i have installed .net framework 3.5 on that machine ... no sql server or visual studio .. how can i make it work ..
also, i tried to create an odbc for my sql server on the other machine .. but was unable to do that .. anyone any idea??
|
|
|
|
|
vishwjeet wrote: Now I am trying to deploy the sever on a machine on my network ... but i have installed .net framework 3.5 on that machine ... no sql server or visual studio .. how can i make it work ..
Why would you need Visual Studio on a production machine?
You need to cleary explain you problem.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
probem is .. im not able to connect to my sql server from the oher machine .. how should i connect to the sql server instance working on my machine i.e.(A) from the other machine i.e.(B).
I dont have sql server management studio on machine (B).
|
|
|
|
|
I would like to make one point clear ..
Whenever my server is on vista machine ... nothing works ... but when i make my xp machine a server .. the same code works fine ...
so this time .. im making my server on xp machine with .net fw installed .. but my sql server is on vista machine .. so i need to access this sql server through n/w as i cannot install sql server on my xp machine
.. is my problem clear from this ..???
|
|
|
|
|
Have you installed SQL server in mixed mode?
If so, then just exempt the sqlbrowser and sqlserv.exe files from your firewall. Create a new login to your sql server and also add that user to the database you want to connect.
you will get those files here :
drive:\Program Files\Microsoft SQL Server\MSSQL.XX\MSSQL\Binn\sqlservr.exe
drive:\Program Files\Microsoft SQL Server\XX\Shared\sqlbrowser.exe
Now connect using SqlAuthentication using the userid and passwornd, and you are done.
|
|
|
|
|
Greetings, I have just developed a content-managed, database-driven application application that makes heavy use of postbacks and session variables. We own the domain that the site was designed to be hosted on, however, the customer does not want our URL showing. The solution our firm has used in the past is to just put the entire application within a frameset with the top frameset at 0% and the bottom one at 100%, thus the only file that needs to live on the customer's site is the frameset itself. In this case, the frameset is a Cold Fusion page but there is no server-side logic--just the HTML frameset. It is a cold fusion page because I'm told this is what worked in the past. They are running the .NET framework on the server but I don't know if they have any .NET sites up there. I was told that this should work because all of the code to run the application should work fine because everything should be self-contained within the frame, however, anytime a postback is done, it tends to lose all of its session variables. To further complicate matters, the same frameset, let's call it frameset.cfm works fine when both the frameset page and application are hosted on the same server, but when only the frameset.cfm page is moved to the client's server, the sessions fail, especially on pages with postbacks.
Could someone explain to me what is going on and help me come up with a workaround? Because we need to contact the customer's IT department each time a file is placed on their server, we are hoping to involve them as little as possible. My next step is going to be to create a frameset.aspx page that will live on their server but I am told that our firm has never had a problem with the frameset.cfm files before...
Ohh, and lastly, It always works in Firefox, and sometimes works in IE. On some IE 8 machines it works all the time, on some IE 8 machines it works most of the time, and on some IE8 machines it fails most of the time...
Thanks in advance
|
|
|
|
|
I am in the same spot you are, only difference is the hosting site calling my frame is a PHP site. Same issues. If I host the parent site no problems. If they are the Parent site, then problems (not holding session variables).
The problem is introduced when you have cross domain sites communicating. You cannot access the parent information and the parent cannot access the child. That being said, I would think my session variables on my server would be maintained for that session.
Today, literally, I changed my response.redirect calls to server.transfer calls. Tonight I'll push the pages and begin testing. More to report tomorrow.
|
|
|
|
|
Good luck with that. Sadly I did that already too. I also neglected to mention that all of the pages where this problem occurs are master pages and things seem highly dependent on the postback. The fact that it works on Firefox has me more confused and wonder how much of it is client-side vs. server side. The next step that was suggested to me is changing all of the logic that involves session variables to query strings but that will prove to be a pretty intense over-haul on a site that has already been thoroughly tested.
Let me know if you have any luck with your conversion though, let me know if it works.
|
|
|
|
|
|
Hi All,
i need to create a gridview, while loading a page default one row should come as empty.
for that i am using footertemplate. when i add any image button to footertemplate first it was empty and then second row onlwards it was showing the controls what i added under footer template.
my requirement is i need to get all items in a first row.
the which i written was mentioned below.
Any idea regarding this help me.
<asp:gridview id="BulkECouponGrid" runat="server" showfooter="true" autogeneratecolumns="false" onrowdatabound="BulkECouponGrid_RowDataBound" onrowcommand="BulkECouponGrid_RowCommand" bordercolor="Gainsboro" cellpadding="5" headerstyle-backcolor="gray" headerstyle-font-bold="true"
alternatingrowstyle-backcolor="LightGray" width="100%" >="" <headerstyle="" backcolor="LightGray" font-bold="True" >
="" <alternatingrowstyle="" <columns>
="" <asp:templatefield="" headertext="Series Start Code" itemstyle-width="100px" footerstyle-width="100px"
="" itemstyle-horizontalalign="Center" footerstyle-horizontalalign="Center" <itemtemplate>
="" <asp:label="" ><="" asp:label>
="" <="" itemtemplate>
="" asp:templatefield>
="" <footertemplate>
="" <asp:textbox="" maxlength="4" asp:textbox>
="" footertemplate>
="" <asp:templatefield>
="" <img="" src="~/images/lock_16_w.gif" visible="false" <asp:imagebutton="" commandname="AddNew" imageurl="~/images/Save.png" <%--<footertemplate>
="" <asp:button="" text="Save" <footerstyle="" horizontalalign="Center" footerstyle>
="" <itemstyle="" itemstyle>
="" asp:templatefield>--%>
="" columns>
="" asp:gridview>
i="" did="" not="" understand="" what="" was="" the="" wrong.="" when="" i="" removed="" last="" <asp:templatefield=""> then it is creating a new row i.e first with all other controls.
|
|
|
|
|
Try alternating row template with repeater and output desired HTML.
|
|
|
|
|
Hi I took a DropDownList and a button, i binded the DDl to a data source.
EMP Table
Emp_Name Emp_No
John 12
Harry 13
Giri 14
The DDL displays the Emp names,
Now when i click a button i want to show a alert which shows the Emp Number of the selected index in DDL
Can you please tell me the code
|
|
|
|