|
I have a web app with some restricted aspx pages and my security check is being done by the master page of the aspx pages. (not sure if this is a great idea).
my problem is if there is no logged in user or he does have the required rights, i forward to a No-Rights error page.
I want to specify this page relative from web-app root. This is important to have portable code (locally pages are at localhost/Project-Name/Restricted/etc..., while on server they are at host/Restricted/etc...)
Someone suggested the ~ option, but this does not work in code behind - it only works in aspx pages. My security checks, of course, are done in the code behind.
any help?
|
|
|
|
|
|
For the full path use Page.ResolveUrl() , for a relative path (relative to the user's browser) use Page.ResolveClientUrl . Both will take in the ~ format and map it to a real path. If you are in a control, the methods are available from Control as well (Page is a type of Control).
|
|
|
|
|
how to get ip address of host computer in C#
|
|
|
|
|
first google hit[^]
I have an article on this site on how to use google.
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.
|
|
|
|
|
you can try this in c#
Me.TextBox1.Text = System.Net.Dns.GetHostEntry(Request.ServerVariables("REMOTE_HOST")).HostName.ToString
Me.TextBox2.Text = Request.UserHostAddress
------------
knowledge is power, try to obtain it
|
|
|
|
|
Hi..
I am using asp.net/c#.
could u tell me how would i pass textbox value to javascript function,
I have one button and a textbox in my aspx file and if user clicks this button, i want textbox value to pass in javascript function.
Now my javascript function returns boolean value true/false , and how would i retrieve this return value , as I want to show messages accordingly.
thanks
By:
Hemant Thaker
|
|
|
|
|
Passing the textbox is easy - you use document.getElementById to get a reference. The ClientID property on the server side will give you the param you need for that. If you want to 'show messages', your best bet is to make controls visible in the same js, or show a confirm or alert message in your js
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.
|
|
|
|
|
Hi..
I am using vs 2005 and can u guide me How would I debug my javascript function...
thanks
By:
Hemant Thaker
|
|
|
|
|
there is some way to get the text box value
one is to use .ClientId in your asp code like this :
document.getElementById(<% textbox1.ClientId %>).value
or if did`nt help you can do something else
the ClientIds always the same as each other , so you can find the ID by view source of the page !
for example it will be like this :
document.getElemetById('ctl00_ContentPlaceHolder1_textBox1').value
|
|
|
|
|
Hiii..
I am using vs 2005 and can u guide me How would I debug my javascript function...
thanks
By:
Hemant Thaker
|
|
|
|
|
hi
i have deployed my web application in lan computer
but suddenly it is not able to access in lan computer
what i need to check
thanks
|
|
|
|
|
Can you ping the machine that has iis in the machine that you cant access your application ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Were you accessing it using IP? if so please check if thats changed.
Check IIS is working properly.
|
|
|
|
|
Check if the IIS web site is running or not. Restart the IIS web site if possible.
Also check if network is available between you and server.
|
|
|
|
|
Hi dude i got this same problem.. The solution is check That LAN Machine Firewall... if it is on, then disable it..It will work...
Bye
SureshKumar.S
sureshkumaran
|
|
|
|
|
Yes. . Agreed. This is the primary requirement. Need to exempt the http ports from the firewall to reach the server.
Its the most basic requirement, Indeed.
|
|
|
|
|
in gridview i want show just 7 rows, how can i set this property?
|
|
|
|
|
Set PageSize=7 of gridview.
|
|
|
|
|
There are multiple option :
1. You can use Page and Restrict the page limit to 1
2. On RowdataBound, restrict the limit.
Thanks !
|
|
|
|
|
There is a nice controll attribute to add e.g.:
this.buttonAdd.Attributes.Add("onclick", "window.open ('SomePage.aspx','Add','scrollbars=1,resizable=0,width=730,height=580')");
say added during Page_Load.
Can I perform such window.open() by clicking on the button without postback? and opening desired page like SomePage.aspx?param=value
Чесноков
modified on Thursday, August 13, 2009 6:27 AM
|
|
|
|
|
Well just make it
this.buttonAdd.Attributes.Add("onclick", "javascript:window.open ('SomePage.aspx','Add','scrollbars=1,resizable=0,width=730,height=580');return false;");
return false means the page will not be posted back.
|
|
|
|
|
No, the code provided already does not present postback after the button is clicked.
What I need is to click the buttonAdd and to open SomePage.aspx in a new window with params passed to SomePage.aspx as a query string.
After the click on the buttonAdd happen, the page with buttonAdd should not post back.
Чесноков
|
|
|
|
|
yes. The code I provided just does that.
Check if you have correctly applied the code or not.
Just see what I have done:
In designer I wrote :
<asp:Button ID="btnid" runat="server" />
On the server side I wrote :
btnid.Attributes.Add("onclick", "javascript: window.open('testform.aspx', 'download', 'left=1000,top=1000');return false;");
Thus whenever the button is clicked the new window will load the page, and it calls the server but the opener window doesnt post back.
If you want to check just place Response.Write("Testing Postback"); on the OnClick event of btnid. You will see the calling page doesnt write the string.
Hope you understand.
|
|
|
|
|
hiii
i want to populate the listview control from database.
eg.search member and the memberdata get display in listview.
i hav tried but its not workin.plz giv me idea wat to do.
thanks in advance...
regards..
|
|
|
|