System.Environment.GetEnvironmentVariable("UserName") Not Working?
Mar 25, 2010
I need to retrieve the windows login name in my asp.net application.
I put System.Environment.GetEnvironmentVariable("UserName") in and it works only when I am debugging my application. However, when I try to run it from the url, and do a response.write it gives an empty string for the "username",how I can get this to work?
View 8 Replies
Similar Messages:
Aug 19, 2010
My application is working fine in local environment but not working after push code in live. My locale environment and hosting environment both are having same configuration. Same app working fine 2 month before but in different domain but same hosting server.
how to check the both config / any possible to run debug mode in hosting server please let me know. below code used in all page for checking user session status but when I click on any link page redirect to login.aspx I think session got timeout. I don't know why session got time frequently, but this issue not happening in local environment (desktop).
[Code]....
[Code]....
View 6 Replies
Apr 1, 2010
I wanted to know what is the use of System. Environment class and what is an object pool in .Net?
View 2 Replies
Jul 16, 2010
Created a new virtual directory on my web sit in IIS 6.. set proper settings and wild card extensions... published via file system from dev environment to the server but i get a page cannot be found 404 error when browsing the site...
View 4 Replies
Jan 5, 2011
I have some inherited code which stores SMTP server, username, password in the system.net/mailSettings/smtp section of the Web.config.
It used to read them like so:
Configuration c = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
MailSettingsSectionGroup settings = (MailSettingsSectionGroup)c.GetSectionGroup("system.net/mailSettings");
return settings.Smtp.Network.Host;
But this was failing when I had to deploy to a medium trust environment. So following the answer from this question, I rewrote it to use GetSection() like so:
SmtpSection settings = (SmtpSection)ConfigurationManager.GetSection("system.net/mailSettings/smtp"); return settings.Network.Host;
But it's still giving me a SecurityException on Medium trust, with the following message:
[Code].....
View 1 Replies
Jul 22, 2010
I have a project in VS 2010 and works great in my dev environment, including a single post that has the def:
[Code]....
But when I publish to another box, I get an error "Could not instantiate file name generator.". This only occurs on the post, all the other ActionResults work fine.
View 2 Replies
Nov 29, 2010
I developed a web page using asp.net 2.0 and ajax toolkit on my laptop on Windows 7 and IIS 6. I have my ajax/atlas toolkit DLL in my bin. The updatePanel works fine and does not postback my page. But when i hosted my website on a dedicated server the page postback totally like i have no updatepanel/ajax in my page...
I am using : Windows server 2008, IIS 6Ajax 2.0 installed on the server. I don t understand what is the difference with windows server or IIS or something else?
View 5 Replies
Sep 17, 2010
have added an asp menu to my site which i populate depending on the user/group from an entity framework object using a re-entrant function. This successfully adds menu items with associated child menu's to level n in the development environment.The problem comes when i publish to the server. when i view the published site the menu view changes and instead of a nice neat menu bar it shows a big list of the correct menuitems in a flat structure blanking out the rest of the page(asp menu is set to horizontal normally)server - windows server 2003 x64 - iis6 - asp 4.0.30319 + net4 framework packsdev - windows 7 - Visual studio 2010i am checking both sites with the same browsers so its not a browser issue.
View 6 Replies
Sep 17, 2010
I am sorry to be asking what is probably a really stupid question, but i have a problem with my asp menu, when i run it on my dev machine(thru vs2010) it works perfectly, all the menu's are displayed correctly with the correct child items in the correct order but when i publish it to the server all the menu items become flat and take up the whole page. I am populating the menu using a reentrant function as follows to call the function and add the menus i am using
Dim childMenuItems As List(Of MenuItem) = CreateMenuLevel(0, uniquemenulist)
childMenuItems.ForEach(Sub(n) NavigationMenu.Items.Add(n))
Public Function CreateMenuLevel(ByVal parentId As Integer, ByVal menulist As List(Of MenuList)) As List(Of MenuItem)
Dim menuItems As New List(Of MenuItem)
For Each menuListItem As MenuList In menulist.Where(Function(n) n.ParentId = parentId)
Dim MenuItem As New MenuItem
If (Not String.IsNullOrEmpty(menuListItem.PagePath)) Then
MenuItem.NavigateUrl = menuListItem.PagePath
End If
MenuItem.Text = menuListItem.MenuName
MenuItem.Selectable = True
MenuItem.Enabled = True
menuItems.Add(MenuItem)
Dim childMenuItems As List(Of MenuItem) = createMenuLevel(menuListItem.MenuId, menulist)
childMenuItems.ForEach(Sub(n) MenuItem.ChildItems.Add(n))
Next
Return menuItems
End Function
now as i say this all works fine in the dev environment so i dont think its a coding issue unless i am missing something mad.
server 2003 x64
iis 6.0
asp 4.0.303.19
relevant .net 4 framework packs installed
dev environment
visual studio 2010
am using the same browser for to check both dev and server
View 2 Replies
Feb 1, 2010
We have a Page Method on a web page using ASP .Net. We tried to put in a trace statement using both System.Diagnostics and System.Diagnostics.Debug. In Visual Studio 2008, the break point is not even hit for the line, but other break points on other lines are hit.There is no output from either method that we can see.
There is also a Global.asax error catcher that works fine in other cases, but in the Page Method is not being catched.why a Page Method and System.Diagnostics do not play well together?
View 1 Replies
Jun 8, 2010
I want to display client system information like username,ipaddress. I get only the remote address.Let me know how to get the client system information.
View 6 Replies
Mar 3, 2014
I need client ip and login user name of a system, while using my web application in ASP.Net ....
View 1 Replies
Oct 26, 2010
Roles.GetRolesForUser(UserName) .I have follwing codes in my Web.config,
<authentication mode="Forms">
<forms slidingExpiration="true" defaultUrl="admin/Welcome.aspx" timeout="60"/> </authentication>
<roleManager enabled="true" defaultProvider="SecurityTutorialsSqlRoleProvider">
<providers>
<add name="SecurityTutorialsSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" applicationName="SecurityTutorials" connectionStringName="SecurityTutorialsConnectionString"/>
</providers>
</roleManager>
View 2 Replies
Apr 15, 2010
How i can pass WebProxy credentials like userid, password, IP,Port and domain. During proxy environment the url does not open.
View 1 Replies
Oct 27, 2010
I made an aspx site with .net 4.0 framework through visual studio and it worked perfectly in the development environment but when I upload it to the server and try to run it I get this error: Server Error in '/' Application. Runtime Error Does anyone have an idea on how to fix this?
View 4 Replies
Mar 12, 2010
How to update username of current logged username?
View 10 Replies
Sep 6, 2010
[Code]....
I have tried different ways. ... How do I test my integer column for DBNull?
I tried
If IsDBNull(Advlnk.RMTest)
Then
Response.Write(
"this is null")
and this doesn't work either.
View 6 Replies
Sep 13, 2010
I have developed a ASP.NET C# web page which connects to remote conmputer command prompt using PSEXEC.exe and executes some command where the output of the command will get copied to the page. It works fine in the VS 2005 IDE.
If the page is accessed via IIS from IE, the task PSEXEC.EXE appears in task manager of the server with the system account privilege after the method is triggered but nothing happens.
find my present settings in IIS and others:
1. APP Pool Identity to Local System (Predefined) and also to a configurable admin account.
2. <processModel userName="SYSTEM" password="AutoGenerate" /> in Machine.Config file
Also I've tried impersonasation in web.config file to an admin account.
Code Is:
[Code]....
View 3 Replies
Feb 4, 2011
public class foo : System.Web.UI.Control
{
public foo()
{
var a = new HyperLink(){ Text="Test", NavigateUrl="~/abc.aspx"};
this.Controls.Add(a);
}
}
The above code works properly, and when added to a page will successfully identify the tilde / ~ symbol and convert the url into a relative url.
However, when I change the derivation of the class to System.Web.UI.WebControl it does absolutely nothing, and leaves the tilde / ~ intact.
I had a look at System.Web.UI.Control which implements the IUrlResolutionService interface, but still can't seem to get System.Web.UI.WebControl to resolve urls.
View 2 Replies
Nov 16, 2010
I have a method which must be run every 5minutes in order to show latest data in gridview.
I was experimenting with System.Timers.Timer and the following is my code:
[code]...
the problem is that after 5minutes it is not going to t_Elapsed. Note this should keep being done at all times not just for once.
View 4 Replies
Jan 7, 2011
I have installed VS2008 on my development machine have winxp sp2 OS.i have created one aspx page where i have placed one button. On click of that button i want to open osk.exe(on screen keyboard). i an using following code
System.Diagnostics.Process.Start("osk.exe")i works fine there.Now for testing i deployed that application to testing server having Win7 OS and IIS7.0. It is not working there.
View 2 Replies
Jun 1, 2010
I am using System.Net.Mail in C#.net website. Basically, I use this to send email alerts to users when some action has occurred.
The problem is, when some PC's are used to trigger an email, nothing happens. I have 2 PC's in my office, and when I do the action on one of them, it works, but not on the other. Why is that?
Also, when an action is triggered by the login page (email reports), it works everywhere, but not on other pages.
I thought C# was server-side code? Shouldn't everything work or not work based on what the server has installed?
View 6 Replies
Jun 9, 2012
after creating a xsd dataset in one machine when i try to use the another in a application in another system though i can use it for fetching records & all i am not able to confidure it or preview data.i already have the connectin string in web config.what changes needs to be done so that the dataset from system 1 can work in ssytem2
View 1 Replies
Jul 21, 2010
In a page (not default) I have:
Protected
Sub Page_Load(ByVal sender
As
Object,
ByVal e
As System.EventArgs)
Handles
Me.Load
Try
loginRep = BusinessLogic.SR.GetUserName("99999")
System.Web.HttpContext.Current.Items.Clear()
System.Web.HttpContext.Current.Items.Add("RepId",loginRep)
I don't any errors and when in the run in the immediate window:
? System.Web.HttpContext.Current.items("RepId") in the immediate window on THAT page I get the OBJECT.
Then I have a hyperlink with navigateurl to the next page "~/ActCnt.aspx"
On that page, ActCnt.aspx, when in the code I have:
Protected
Sub Page_Load(ByVal sender
As
Object,
ByVal e
As System.EventArgs)
Handles
Me.LoadIf
Not Page.IsPostBack
Then
Dim loginRep
As BusinessLogic.SalesRep = System.Web.HttpContext.Current.Items("RepId")
In the immediate window ? System.Web.HttpContext.Current.Items("RepId") returns a String that is equal to "RepId".
Even if I change it to not be an object, but a string I only get the Name "RepId" of the keypair. I have NEVER gotten the actual value.
View 2 Replies
Apr 22, 2010
I have a sitemap of 5 items. 2 items i only want the admin to see. I want the user to be able to login and the system recognise who it is and if an admin, bring up the 2 items in the sitemap. If not an admin, hide the items.
View 3 Replies