Getting DomainName\UserName From A Web Request?

Mar 19, 2011

I am developing a intranet application.I am getting domainname\username details with

HttpContext.User.Identity.Name but the problem is when i disable windows authentication it;s not returning any value.

How to get the domainname\username details irrespective of the client request originating from windows or linux.

what is Iprinciple and can we get domainname\username details from Iprinciple.

View 5 Replies


Similar Messages:

Security :: Couldn't Get Strip To Remove The Domain From The Username (as The Format Is Domainnameusername)?

Aug 26, 2010

I've got a literal control to display the username of the user logged into our companies intranet system, originally I had a LoginName control but couldn't get strip to remove the domain from the username (as the format is domainnameusername) so I'm trying it this way.

[Code]....

protected void Page_Load(object sender, System.EventArgs e)

View 7 Replies

HttpHandlers / Modules :: HttpModule That Alters Request.QueryString And Request.Form?

Jan 27, 2011

We're trying to implement functionality that intercepts, inspects, and alters if needed data in the Request.QueryString and Request.Form collections.

Since Request.QueryString and Request.Form are readonly, is it possible to use a HttpModule to do this without Reflection or Response.Redirect?

We're thinking that we can construct a new HttpRequest, and replace the original one. Would there be any implications in doing this?

I know mocking this object is impossible without using HttpRequestWrapper, but wasn't sure whether ASP.NET sets other things beyond the constructor.

View 2 Replies

WCF / ASMX :: Request Failed With HTTP Status 400: Bad Request Accessing Web Service

May 15, 2010

I have a webservice which works 100% fine on my developer machine. Where Web Service is installed on LOCALHOST on my developer machine,Then i went to my servers, I installed webservice on one server and map it with the server where the website is hosted, Then i tried accessing this service using BROWSER from my web server, it worked fine, That means the mapping was done perfect.Then i run my program on web server (website). It worked fine on page1, then on page2, but when i did the same and call same function on page3, It popped me any error of

View 4 Replies

Accessing IIS's Request Handling Pipeline To Inject A Request And Get The HTML Response?

Dec 9, 2010

Is it at all possible to inject a request into IIS for a page, have IIS and ASP.Net handle it as normal, but get the response as html handed back to me programmatically?

Yes, I know that I could connect to port 80 using WebRequest and WebResponse, but that becomes difficult if you are accessing the IIS server from the same physical machine (loopback security controls et al).

Basically, I want to inject the request (eg for [URL]) between the points at which IIS would normally talk to the browser, and the point at which it would route it to the correct ASP.Net application, and get a response back from IIS between the points at which ASP.Net/IIS applies the httpfilters and hands the html back to the browser.

I'm predominantly working with IIS7 so if there is a solution that works just for IIS7 then thats not an issue.

View 2 Replies

MVC :: Request.Params Request.Form Not Working In Internet Explorer 8?

Jun 29, 2010

This is a input

<input type="image" src="<%=Url.Content("~/images/shopping-cart.jpg")%>" alt="shopping cart" id="btnshoppingCart" name="btnshoppingCart" value="shoppingCart" />

when i browse the page with firefox and click on the input Request.Params["btnshoppingCart"] != null or Request.Form["btnshoppingCart"] != null is statisfied.

When i browse the same page with internet explorer 8 and click on the same input Request.Params["btnshoppingCart"] != null or Request.Form["btnshoppingCart"] != null is not satisfied. When i used the watch i saw that there is no key by the name of "btnshoppingCart" in either Request.Form or Request.Params if input is clicked from internet explorer. However when it is clicked from firefox there is value "shoppingCart" inside Request.Form and Request.Params against "btnshoppingCart" key. One more strange thing that i observed was that are two keys "btnshoppingCart.x" and "btnshoppingCart.y" inside both Request.Form and Request.Params whenver clicking is done from both internet explorer and firefox. This is happening against all inputs of type image irrespective if the input is present inside a html form or not. Forms are created like this

<% using (Html.BeginForm("Action", "Controller", FormMethod.Post)){%>

The version of internet explorer is 8.0 and firefox is 3.6.6

View 5 Replies

Determine If A HTTP Request Is A Soap Request On HttpApplication.AuthenticateRequest

Jan 21, 2010

I there a way to know if a request is a soap request on AuthenticateRequest event for HttpApplication? Checking ServerVariables["HTTP_SOAPACTION"] seems to not be working all the time.

public void Init(HttpApplication context) {
context.AuthenticateRequest += new EventHandler(AuthenticateRequest);
}
protected void AuthenticateRequest(object sender, EventArgs e) {
app = sender as HttpApplication;
if (app.Request.ServerVariables["HTTP_SOAPACTION"] != null) {
// a few requests do not enter here, but my webservice class still executing
// ...
}
}
I have disabled HTTP POST and HTTP GET for webservices in my web.config file.
<webServices>
<protocols>
<remove name="HttpGet" />
<remove name="HttpPost" />
<add name="AnyHttpSoap" />
</protocols>
</webServices>
Looking at ContentType for soap+xml only partially solves my problem. For example,
Cache-Control: no-cache
Connection: Keep-Alive
Content-Length: 1131
Content-Type: text/xml
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: ro
Host: localhost
mymethod: urn:[URL]

Some clients instead of having the standard header SOAPAction: [URL], have someting like in example above. "mymethod" represents the method in my web service class with [WebMethod] attribute on it and [URL] is the namespace of the webservice. Still the service works perfectly normal. The consumers use different frameworks (NuSOAP from PHP, .NET, Java, etc).

View 4 Replies

First Request Fails With HTTP 400 (Bad Request) After Reading HttpRequest.InputStream

Oct 24, 2010

I develop an asmx web service (i.e. ASP.NET 2.0). There's a piece of code that may read the contents of the HTTP request (via HttpContext.Current.Request.InputStream) while processing it. I realise that InputStream may only be read once for a request, and I make sure I never try to read it more than once.

The problem seems to be that if InputStream happens to be read during the early stages of the application's lifecycle (e.g. after pskill w3wp, during Application_Start), the HTTP request fails with a HTTP 400 - Bad Request error, with no explanation given, no exception thrown and no entry in the httperr log. If it is read later (e.g. within the web method itself), requests run fine whether InputStream is read or not. Application_Start runs fine if InputStream isn't read.

Is this some sort of ASP.NET bug? IIS bug? Or am I doing something wrong by daring to read InputStream? And if so, is there another way to get a look at the "raw" contents of the request without disturbing the inner workings of IIS/ASP.NET? In short, adding this code within Application_Start is enough to reproduce this error: using (StreamReader reader = new StreamReader(HttpContext.Current.Request.InputStream))reader.ReadToEnd();

View 1 Replies

How To Bypass Request Size и Request Processing Time Restrictions

Mar 1, 2011

I want to component to upload large filesP.How can I bypass request size и request processing time restrictions?

View 4 Replies

PHP Curl Request To IIS Results In Request Format Is Invalid?

Apr 4, 2011

I am trying to use curl to access 3rd party webservice, I used the following code which works well if I try it on my own linux server, the data is being sent ok, but the IIS on the 3rd party server returns an error.

$longdata is a long string of data, maybe over 1000 characters long the 3rd party has many working clients with various implementations so the problem is on my side. what do I need to add to the request in order to get this through ?

<?php
$c = curl_init();
// curl_setopt($c, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($c, CURLOPT_URL, 'http://XXX.com/test/index.asmx');
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_HEADER, 1);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$post = array('param1' => 'XXXX', "param2" => "Y", "Param3" => $long_data);
curl_setopt($c, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($c);
echo $response;
/*

Response:

HTTP/1.1 100 Continue
HTTP/1.1 500 Internal Server Error
Date: Tue, 05 Apr 2011 14:11:51 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/plain; charset=utf-8
Content-Length: 100
Request format is invalid: multipart/form-data; boundary=----------------------------5d738237d9e0.
*/
?>

View 2 Replies

WCF / ASMX :: Calling A Web Request - 400 Bad Server Request?

May 28, 2010

I am facing an issue while calling a web request thru my code. I have searched a lot on number of sites but did not get any solution.

Here is the code which I am using:

[Code]....

View 3 Replies

Request.RawUrl Versus Request.Url

Jan 7, 2010

What is the difference between Request.RawUrl and Request.Url in ASP.NET?

View 3 Replies

.net - Difference Between HttpContext.Request And Request?

Apr 5, 2011

What is the difference between the three ASP.NET objects:

HttpContext.Current.Request
HttpContext.Request
Request

Are these exactly the same?

Edit 1

Do these objects behave differently inside global.asax/global.asax.vb and default.aspx/default.aspx.vb.

Edit 2

OK I'll try to be specific this time. Which of the following should I use:

' File: global.asax
Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs)
If Request.Url.Port = 80 Then
'If HttpContext.Current.Request.Url.Port = 80 Then

[Code]...

View 2 Replies

Web Forms :: "Request Is Not Available In This Context" For Threaded Call To Request.Path

Dec 22, 2010

How do I call Page.Request properties from a thread after the host headers are gone.

I used:

[Code]....

in Page_Load, but still get the error.

My ASP.NET Web app has a thread which calls a method in the Page. This method then calls:

searchQuery = Page.Request.Path

This throws an exception with a message of, "Request is not available in this context."

View 2 Replies

Security :: Encrypt Request.querystring And Descrpt Request.querystring

Apr 24, 2010

Encrypt request.querystring and Descrpt request.querystring

View 1 Replies

Security :: Pass Credential From On Request To Another Request (one Site To Another Site)?

Jul 27, 2010

WebApp1: on IIS and configured with Windows authentication. Get User account from AD.

WebAPP2: a java web app on another windows box in same domain with authentication from AD

On web app1, I have a http handler like

public class MyHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string url = "http://WebApp2/Test";
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(url);
CredentialCache myCache = new CredentialCache();
NetworkCredential netCredential = new NetworkCredential("myname", "mypassword", "");
myCache.Add(new Uri(url), "Basic", netCredential);
//...
myReq.Credentials = myCache;
//....
}
}

in above way, I can set authentication in code and pass it WebApp2.

But I don't want to put name and password in code. User info already available on WebApp1: in context.User I can find out the user info who already logined into WebApp1, so I want to pass this credential to WebApp2. I have tried to do following:

myReq.Credentials = CredentialCache.DefaultCredentials;

but I am failed becuast there is no data in CredentialCache.DefaultCredentials.

View 1 Replies

C# - Use Request.UrlReferrer And When Request.ServerVariables["HTTP_REFERER"]?

Aug 25, 2010

Both returns the incoming url, Just to know When to use Request.UrlReferrer and when Request.ServerVariables["HTTP_REFERER"] and why?Currently, in one of my application Urlreferrer is working in my local machine but its not working when went live?Additionally, its most appreciable if anyone can guide any alternative of both Urlreferrer and HTTP_REFERRER?

View 1 Replies

Request.PhysicalPath Errors With "Name Request Is Not Declared"

Jul 8, 2010

I have created a VB DLL by selecting File - New - Project and then Class Library

I added a "Properties" region and a "Function" region with some simple properties and one simple function. Compiled it and used it in another app with no errors.

At that point the only references in the project were the default references when creating the new project.

I then created a function that will take a file as a param and get the physical path and add the 2 together. In the function I use the "Request.PhysicalPath" method of the System.Web.UI.UserControl.

I then added areference to the System.Web DLL in my project.

PROBLEM IS I get an error on "Request" that says "Name Request is not declared"

So I googled the error which I found a thread that said to "just use HttpContext.Current.Request.Form" because "by default all websites developed in Visual Studio 2005 is Inherited from System.Web.UI.Page and Class files won't that's the resion we have to add System.Web.UI.Page namespace in the class file"

However when I added the "HttpContext.Current.form." before my "Request.PhysicalPath" I get the same error on "HttpContext".

System.Web.UI.UserControl

View 5 Replies

Error For Failed Request Tracing: "a Failed Request Trace For This Content Already Exists"

Dec 17, 2010

I am trying to add Failed Request Tracing to my IIS 7/ASP.NET server.

First, I create failed request tracing for "all content, error codes 400-999" because want to save all errors.

Then, I try to create a trace for "all content, time: 5 seconds" because I want to trace all "long" requests. However, IIS 7 gives me an error: "A failed request trace for this content already exists".How can I add this second trace for all content that takes > 5 seconds?

View 1 Replies

HttpHandlers / Modules :: Hanging Request.Form Collection Values / Request.Form Collection Is Readonly

Jun 20, 2010

I'm using HttpModule to capture requests to the web server. Before processing the page I'd like to check the values contained in some keys of the Request.Form collection and according to some logic change if necessary. I'd like to do this when BeginRequest event is fired. The problem is that the Request.Form collection is readonly.

View 4 Replies

Get Request.Form.Item By Matching Request.Form.Key?

Jul 6, 2010

My Request.Form keys are all prefixed with ctl00$container name$ and then the key I want.

How can I get the regular key name working?

Visual example from the immediate window:

I want to use:

? request.Form.Item("stationIdea")

but it won't work because the key is:

ctl00$content_innovation_body$stationIdea

as retrieved by

? request.Form.Keys("4")

so only this works:

? request.Form("ctl00$content_innovation_body$stationIdea")

View 1 Replies

C# - Request Is Not Available For PDF Request?

Jun 11, 2010

We're trying to create a .NET aspx page that will have a PDF within it. Doing this by hardcoding it is easy.

<object height="1250px" width="100%" type="application/pdf" data="our.pdf">
<param value="our.pdf" name="src" />
<param value="transparent" name="wmode" />
</object>

(don't worry too much about the transparent thing...we're doing that for other reasons...but I include it here "just in case".)The problem is when we want to generate the PDF dynamically. Our code to populate the literal on the front end looks like this:

ltrPDF.Text = String.Format("<object height="1250px" width="100%" type="application/pdf" data="ourPdfGenerator.aspx?var0={0}&var1={1}&var2={2}">", var0, var1, var2);
ltrPDF.Text += String.Format("<param value="ourPdfGenerator.aspx?var0={0}&var1={1}&var2={2}">", var0, var1, var2);
ltrPDF.Text += "<param value="transparent" name="wmode"/>";
ltrPDF.Text += "</object>";

Kind of ugly, but it seems like it should work. But it doesn't.When I debug, and put a breakpoint on the first line of ourPdfGenerator.aspx.cs Page_Load method, I reach the breakpoint without any difficulty. However, the first thing we do is try to use Request.QueryString:

string var0 = Request.QueryString["var0"];

which immediately throws an HttpException: "Request is not available in this context." I'm not clear on:

Why isn't it available? What can I do about it?

EDIT: (as an aside, I know it seems a bit weird to ask for a mime-type of pdf from a aspx page...but we've used an aspx page to generate cs pages before...we do something like this:

Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment;filename="our.pdf"");[code].....

And this has been working fine in other contexts for a while...but always as its own page. What we're doing differently now is instead of having this page called directly, we're trying to embed it, so it's being called from the <object> tag, which is apparently causing problems...

View 1 Replies

Get Time Of Last Request?

Jul 20, 2010

How can I get time of last request Sent in asp.net.. Actually I want to set automatic Idle timeout. So I planned to compare this time with current.

View 4 Replies

How To Get Xml Web Service Request

Jan 11, 2011

I'm submitting a request to a web service, but I'm receiving some errors. They've asked to see an example of the xml request and response. I used Visual Studio to consume the web service, so I'm just calling a method in my code - I don't actually see any xml. Is there a way to grab the XML request and response as XML or at least a text string?

View 2 Replies

MVC :: How To Request Parameter URL

Jun 21, 2010

I need to edit URL like this below www.abc.com/Search?key=xxx I want to pass new variable and request it from URL.

View 10 Replies

How To Return A Pdf From A Web Request In .NET

Jan 13, 2010

Simply put, I'd like someone to be able to click a link, and get a one-time-use pdf. We have the library to create PDF files, so that's not an issue.

We could generate a link to an aspx page, have that page generate the pdf, save the pdf to the filesystem, and then Response.Redirect to the saved pdf. Then we'd somehow have to keep track of and clean up the PDF file.

Since we don't ever need to keep this data, what I'd like to do instead, if possible, is to have the aspx page generate the pdf, and serve it directly back as a response to the original request. Is this possible?

(In our case, we're using C#, and we want to serve a pdf back, but it seems like any solution would probably work for various .NET languages and returned filetypes.)

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved