How To See The Current URL From Browser
Jun 22, 2010how to see the current URL from browser?
Is the user coming to my page directly via www.mypage.com/myapp or through apps.facebook.com/myapp
how to see the current URL from browser?
Is the user coming to my page directly via www.mypage.com/myapp or through apps.facebook.com/myapp
In my website I am maintaining log of users in which I am storing some user's information such as user machine IP umber,SessionId,UserName etc.and able to show the list of current and past users in webpage. I want to share and connect to browser session of any of the current users. Is it possible,if yes then how?
View 5 RepliesI'm creating an ASP.NET MVC 2 (RTM) project that uses areas. The Index action of the Home controller of one area needs to use RenderAction to generate a sub-section of the page. The action called is also defined in the same Home controller. So the call should just be:
<% Html.RenderAction("List") %>
However, I get an exception:A public action method 'List' was not found on controller 'RareBridge.Web.Areas.Events.Controllers.HomeController'.
Note that I'm not in the "Events" area! I'm in a completely different area. If I remove the "Events" home controller, then the exception still occurs but names a different controller (still not the one I want it to call).
I've also tried providing the controller name and area to the RenderAction method, but the same exception occurs. What is going on here?
BTW: I am using Autofac as my IoC container
I am looking for a way to figure out the current URL that the page is currently on (NOT what the asp.net page currently is, but where the CODE is at). ie. My web app is located at: [URL] my code is: String page = [URL]
String response = GetResponse(page); //basically the above code goes to the website [URL] and parses the HTML within it and brings it back and populates the variable string "response". But, sometimes the [URL] throws me a curve ball and redirects me to: [URL] I want to be able to use a try/catch to be able to "catch" the error of a different page: ie validateUser.aspx. So, I need to do to this: try
{
String page = [URL];
String response = GetResponse(page);
}
catch
{
//code to check the behind URL to see if [URL] is the URL OR IF [URL] is the current URL
}
understand I know how to find the URL of the current page the web app is on. I need to find the current page that threw the exception during the execution of the code behind.
I have a static class with serveral static methods. In these methods, I'm trying to access the current thread's context using HttpContext.Current. For example:
var userName = HttpContext.Current.User.Identity.Name;
However, when I do that, I receive a NullReferenceException, the infamous "Object reference not set to an instance of an object."
I am building in error-logging into my site, and want to be able to get hold of the current page name that the error occurred in, as well as the specific subroutine or function, to then pass to a VB.NET function. Is there anyway to get hold of this information without hard-coding the names manually? For example,
Dim strCurrentPageName = ???
Dim strCurrentRoutine = ???
I have website home page which my client can view well on his blackberry mobile phone but I have link buttons on that page which redirect the users to other pages ..just Response.Redirect ............simple code.... but when he clicks on the link, it requests for enabling javascript..I do that but the home page just does a postback. Links are not working on cellphone........... on regular website they are working fine.
View 2 RepliesI used javascript code to open popup window.Popup window "Maximize" button is inÂ
disable state.But in Chrome it is in enable state.I want to make browser maximize button disable.
Below is my javascript code
function Call_PopUp(event, URL) {
window.open(URL, 'CustomPopUp', 'width=990, height=540, menubar=no,scrollbars =yes, resizable=no, top=50,left=50,toolbar=no,dialog=yes,minimizable=yes,maximizable=no');
}
i need to get the Browser version, type of the user. i need the short name not the long one.
at the monent i have this:
browser = Request.ServerVariables("HTTP_USER_AGENT") that retuens this:
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249
i need only (Chrome/4.1.249), (MSIE 8.0)...............
plus i would like to get the operating system too
I have a web application that runs via IIS 7 what i want to do with the application (Asp.net with C#) is only load if the browser is greater than IE9, or greater than or equal to Chrome27 or greater than or equal to firefox19. Â
How to do this or areas i should read to do such a thing?
How to create Jobs, I am using SQL 2005, i need a query which should get current date and compare current date with date in table and Send Email according to Job scheduled.
View 4 RepliesIm calling the new popup window from gridview like
[Code]....
In the AddTargetPopUP.aspx ,I have button Call "ADD".When i click the add button it'll insert datas into database.I want to reload the parent gridview after insert into the database and want to close the popup.
i am using a actionlink in master page of user module.i want to pass the eventid of the current url(in all views) to the actionlink as a route value.But i use the following code,
<%=Html.ActionLink("Create Account", "UserRegistration",
new { eventid = ViewContext.RouteData.Values["id"] })%>
But it doesnot retrieve the id fom the url.
my url is in following formate,
[URL]
here eventID=2 is common for all views.So i want to send this eventID to the actionlink as route value.
I'm using a sqldatasource to insert my data to the database table. And in the table the first coulmn is the ID (auto generated by SQL). I would like to know if it's possible to get the ID just after inserting the data to the table?
View 14 Repliesi want to get the url of current page. I dont want to get only the page name. I want to get the whole url including the query string.
I used this Request.ServerVariables("URL") but it only returns me the page name.
For example current url is : index.aspx?id=10&return=50
It returns me only index.aspx. But i want the whole url.
For instance if I have [URL]. Store about.aspx (or whatever page we're on) in a variable. Also need this to work even if there is information after the page in the url such as a query string.
View 1 RepliesHow to get current page URL, I used this "Request.Url" is working fine. But I am using URL rewrite. So it is not showing the current page URL. it is show the corrent URL of the Page. But I want the current page URL only. We can get this in client side. By using javascript "location.href". But I want same thing in server side. Is it possible? example for Request.Url :-[URL]( I used rewriting url) I want this url in server side. the I used request.Url it is showing [URL] this is the right path. even it is not showing querystring too [URL]
View 6 RepliesI have written an ApplicationController as an abstract class that encapsulate serveral methods that must be executed before the "real" controller is executed. In the AppliationController I want to receive the name of the action that is currently executed.
I tried several codes I find on the web (e.g. ControllerContext.RouteData.GetRequiredString("controller") but the controllercontext is always null...
How can I receive the name of the current controller in mvc 2.0?
I have a Gridview with delete and edit buttons looks like
<asp:GridView ID="grdTrackedItems" runat="server" AutoGenerateColumns="False" Width="330px"
BorderStyle="None" OnRowDataBound="OnRowDataBoundTrackedItems" OnRowDeleting="OnRowDeletingTrackedItems">
<Columns>
[Code]....
I have a text box and Save button on bottom of the page. I want to display the item name in the textbox when I click on the edit button from gridview. How can I do this?
I thought this would be a simple task as I am trying to get the current logged in domain user name. I have the following:
[Code]....
but it ALWAYS returns nothing ""
Is there some configuration in the ASP that I have to do first?
HOw can i capture the second part of the url:For example:
http://www.yahoo.com/News/tezst/result.aspx
Should return:http://www.yahoo.com/News/
==================
http://www.yahoo.com/entertainment/default.aspx
Should return:
http://www.yahoo.com/entertainment/
This is probably simple, but from an ASP.NET web page, how would I get the current time as EST, regardless of what time it is on the server (the server of course being located in a time zone other than EST)?
View 5 RepliesHow can I perform a redirect with Server.Transfer() to the same page that is currently shown. I want to have A cleared form after submit.
View 2 RepliesI'm trying to extend ScriptManager to simplify dealing with resources that have multiple resource files (e.g. more than one script file as well as css). The goal is that I will be able to add a single ScriptReference to Scripts and have it load more than one resource related to that reference name.
What I'm getting stuck on is, how does your basic ScriptManager know what to do with stuff when when using static methods that do not include a Page parameter? For example:
ScriptManager.ScriptResourceMapping.AddDefinition("someName", new
ScriptResourceDefinition { Path="/script/somescript.js"});
This adds a definition to (I guess) whatever the active script manager is for the page that's running when you call it. But unlike the old-school methods, like RegisterClientScriptBlock there is no parameter passed that identifies the page. But this stuff must get stored in the ScriptManager object, no? So how does it know?
I could always get a reference to the active one with this:
ScriptManager.GetCurrent(page);
but ideally, I would create new methods that work exactly like Microsoft's. I can't figure out how I could implement something like
ScriptManager.ScriptResourceMapping.AddDefinition(string name,
ScriptResourceDefinition definition,
ResourceType type)
that could figure out the object instance to add the stuff into without having to add a Page parameter.
I am playing around with MVC 2.0 and have changed a few colors in the Site.css to suit my preferences but can't seem to get normal tab behavior for the menu to work. Most web pages that have tabs have a different color for the current tab, i.e. the current "Forums" tab on this web site is a different color from all the rest. Is there a way to easily hook this up or a hard way?
View 7 Replies