UrlRewriting.Net Module + IIS7 Equals Page.User == Null?

Jan 8, 2010

I've used the UrlRewriting.Net module for a couple years now without any problems in Windows XP and Windows 2003. I just recently upgraded my home PC to Windows 7 and started developing a new website.The plan was to use .html extensions and rewrite them to their .aspx counterparts using the UrlRewriting.Net module. Everything works flawlessly in VWD 2008, but when I try running it through IIS7 it is a different story.

When I try to access a page via the .html rewrite I can no longer access Page.User; it keeps returning null. If I hit the page using it's .aspx extension, Page.User is correctly populated. I should also mention that I have a LoginView controller in my Master Page and it suffers from the same symptoms: When accessing via .html extension it shows the AnonyousTemplate; When using .aspx extension it properly shows the LoggedInTemplate. I'm guessing the two are related.

[Note: I've also tried extensionless URLs and they exhibit the same problem]

The only way I've gotten it to work is to switch the application pool to Classic, which then requires me to add an ASP.Net ddl handler for the .html extension [otherwise it is handled by the StaticFileHandler and comes up as a 404 error]. However, I'd like my web app to run properly for people without having to fiddle around with IIS.So I am left with several questions:Does anyone have ideas as to why Page.User always equals null for .html => .aspx rewritten pages?

Why does it work in VWD 2008, but not IIS7?

What changed from IIS6 => IIS7 that could have caused this?

[Note: I just tried a .aspx => .aspx rewrite and it did not exhibit the problem. Not really what I want, but thought I should mention it.]

View 2 Replies


Similar Messages:

Security :: UrlRewriting.Net Module .html Extension On IIS7 Equals Page.User == Null?

Jan 8, 2010

[FYI - Posted the same thing over at StackOverflow]I've used the UrlRewriting.Net module for a couple years now without any problems in Windows XP and Windows 2003. I just recently upgraded my home PC to Windows 7 and started developing a new website.The plan was to use .html extensions and rewrite them to their .aspx counterparts using the UrlRewriting.Net module. Everythingworks flawlessly in VWD 2008, but when I try running it through IIS7 it is a different story.

When I try to access a page via the .html rewrite I can no longer access Page.User; it keeps returning null. If I hit the page using it's .aspx extension, Page.User is correctly populated. I should also mention that I have a LoginView controller in my Master Page and it suffers from the same symptoms: When accessing via .html extension it shows the AnonyousTemplate; When using .aspx extension it properly shows the LoggedInTemplate. I'm guessing the two are related.[Note: I've also tried extensionless URLs and they exhibit the same problem]The only way I've gotten it to work is to switch the application pool to Classic, which then requires me to add an ASP.Net ddl handler for the .html extension [otherwise it is handled by the StaticFileHandler and comes up as a 404 error]. However, I'd like my web app to run properly for people without having to fiddle around with IIS.

So I am left with several questions:Does anyone have ideas as to why Page.User always equals null for .html => .aspx rewritten pages?Why does it work in VWD 2008, but not IIS7? What changed from IIS6 => IIS7 that could have caused this? Any other thoughts on workarounds?[Note: I just tried a .aspx => .aspx rewrite and it did not exhibit the problem. Not really what I want, but thought I should mention it.]

View 5 Replies

Configuration :: Default Page Not Working On IIS7 With URL Rewrite Http Module

Jan 18, 2010

I have the following setting in my web.config to redirect to a default page:

<defaultDocument>
<files>
<clear/>
<add value="default.aspx"/>
</files>
</defaultDocument>

For example when a user enters www.homeforhire.com they should be redirected to default.aspx (for operational reasons the user is then redirected to
www.homeforhire.com/home.aspx).

Instead an error is caught in the Rewrite module (which should not be activated). I am using an http module to perform URL rewriting.

It appears as if the default document setup is not working correctly, and the requested page ~/ is being sent to the Rewrite module, causing an error (which is then caught by my error handler and the user is redirected to the home page).

Entering www.homeforhire.com/default.aspx works correctly.

Can anyone tell me why the default document settings in the web.config do not appear to be working?

View 1 Replies

Web Forms :: MyFileInput.PostedFile.ContentType Equals Null?

Nov 1, 2010

Simple upload has been working for quite a while now, yet it seems to all the sudden not work (but only for specific file types). mp3 can upload, flv cannot (remember, this was all working before).After a little debugging, I discovered that a portion of my code is never being entered because I test something first:

[Code]....

I have discovered that resourceMediaFile.PostedFile is not null, resourceMediaFile.PostedFile.ContentLength is the correct size for the uploaded file, yet resourceMediaFile.PostedFile.ContentType is now null. I've literally had this work over 1,000 times with several files (including the one I'm testing with) and it consistently came back "application/flv".

What would cause ContentType to be null if the other attributes are not?

View 3 Replies

Asp.net - IIS7 Itegrated Pipeline Mode: Context.User Is Intermittently Null For Windows Auth?

May 19, 2010

Our code relies on checking the Context.User.Identity value in the Global.asax Application AuthenticateRequest(...) method to retrieve some information about the logged in user. This works fine in classic mode but when I flip IIS to use the Integrated Pipeline "Context.User" comes back as null, but only intermittently.I have < authentication mode="Windows"> and only Windows Auth enabled in the Virtual Directory.

View 1 Replies

Iis7 Url Rewrite Module With Html?

Feb 19, 2010

Is it possible to use iis7 url rewrite module for html pages?

Like this:

http://www.site.com/index.html?x=newfolder =>
http://www.site.com/newfolder

View 2 Replies

Security :: UrlAuthorization Module Does Not Work Expect On IIS7?

Sep 21, 2010

Here are the structure of my web site:Login.aspx in the root pathUserInfor.aspx and 1.txt in the sub-directory folder named 'Restricted' Authenticate this website with form authentication configured in IIS, and does not allow anonymous to get into the Restricted folder with the web.config file.I think it should work this way, if I manually access the 1.txt in the browser, I should be able to view the content, and if I go to the modules configuration for this applicaiton in IIS7, find the 'UrlAuthorization' module, and cancle the listbox for 'invoke for requests to asp.net ...', I should be directed to the loginurl setting in the root web.config file when I access the 1.txt file without logging, however, I still can see the content of 1.txt.

View 1 Replies

How To Use The IIS7 URL Rewrite Module To Reroute HTTP Requests To HTTPs

May 6, 2010

I have web services built with ASP.NET and ASP.NET clients consuming them. When consuming the webservices, how would I to force the clients to use https?

I don't want to force the whole site to use https by turning on require SSL in IIS.

Can I use the IIS7 URL rewrite module to re-route http requests to https?

View 2 Replies

Forcing Https And Avoid Duplicate Urls Using IIS7 Url Rewrite Module

Feb 16, 2011

I need to force every request to https://www.mysite.com (always with https and www)

The site is hosted in GoDaddy and I need to do it via IIS7 URL Rewrite Module.

I've been able to do the HTTPS redirect with the following code:

<system.webServer>
<rewrite>
<rules>
<rule name="Canonical Host Name" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^mysite.com$" />
</conditions>
<action type="Redirect" url="https://www.mysite.com/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>

Test cases

http://mysite.com -> https://www.mysite.com OK
http://www.mysite.com -> https://www.mysite.com NOT WORKING

I guess the condition is not being satisfied when I enter www.mysite.com in the browser, so there's no redirect and the page serves as HTTP instead of HTTPS.

I think I just need to modify the condition pattern, but I have almost nothing regex knowledge and I need this asap.

View 1 Replies

Block Direct Access To .aspx Pages Using IIS7's URLRewrite Module?

Mar 30, 2011

I am using IIS7's URLRewrite feature to hide the .aspx extension in my ASP.NET WebForms application's URLs.

I'm using the following configuration:

[code]....

I can now browse to:

[URL]

and this is rewritten to:

[URL]

This preserves the "pretty" url in the browser address bar. I have also updated all my links on the site to use the extensionless URLs.

The problem is that the underlying .aspx pages can still be accessed directly and I'd like to prevent this.

If a user browses to [URL] I'd like it to either redirect/rewrite to [URL], or at the very least just return a "Page not found".

Update:

I managed to get this working by redirecting all .aspx pages to the home directory. This isn't ideal as I'd prefer to send them to the non-.aspx version, but it will do for now.

<rule name="Block .aspx" stopProcessing="true">
<match url=".aspx" />
<action type="Redirect" url="/" />
</rule>`

How do I rewrite and redirect URLs that directly address .aspx pages to my friendly URL format?

View 2 Replies

HttpHandlers / Modules :: Session Null In Module Event (PreRequestHandlerExecute) For .asmx Web Service ?

Jun 18, 2010

I have a module that subscribes to PreRequestHandlerExecute event, which uses the Session object. When i set the webconfig compilationdebug flag to false, the Session object is null when making requests to the web service. It works fine for .aspx requests, but only have problems for .asmx. When i set the debug flag to true everything works fine. I need to set this flag to false for production, but can't seem to get it work.I'm using II7 and the integrated pipeline, so this event will fire for all requests.

View 1 Replies

User Controls :: Validate Session Set After Login And Redirect User Back To Login Page If It Is NULL

Apr 26, 2013

I have made a web page in which there is login screen when user login it goes next page but my problem is if i directly enter the url of that page it open. I want it should not open unless the user log in... 

View 1 Replies

Page.User Is Null During AJAX Request?

Jul 26, 2010

I'm using the MVC2 framework and one of my views has a bit of conditional logic that gets the Page.User.Identity object and does a comparison with other values to determine what to display.That all works fine on the initial page load, but when I make an AJAX call to get partial page updates (I'm doing this all manually with YUI3, not the .NET AJAX stuff) the Page.User object is always null.

View 1 Replies

State Management :: Set Value To Null Where User Is Leaving The Page?

Jan 10, 2011

I want to terminate an application stat or set value to null where user is leaving the page...

does anyone know how can I do that?

View 13 Replies

Web Forms :: Databound Item.Count Equals "1" On Page Load?

Mar 30, 2010

[I'm working in Microsoft Visual Studio 2005 with C# Language]There is a series of forms that I'm prepopulating with data from a SQL database. Every page that I've created in this way I've coded the needed information required into the method:protected void Page_Load(object sender, EventArgs e)and doesn't fire if it's a postback event.This latest form has a CheckBoxGroup that is databound and populates based on a table in the database. However, the form only prepopulates after a postback. Prior, the Item.Count says 1 when I know that there are 14 items. Again, it reads fine after the postback. I assume that this is because the CheckBoxGroup populates after the Page_Load function.Is there a way that I can make something like this fire during the Page_Load and not during the postback?

View 2 Replies

State Management :: Redirect User To Login Page If Session Is Null?

Sep 7, 2010

i have 2 page,

1.login.aspx --- 2.welcome.aspx

in my login.aspx im storing username into sesssion as below:

Session["usernm"] = txtUsername.Text;
in my welcome.aspx page
in page_load event
if (Session["usernm"]==null)
{
Response.Redirect("Login.aspx");
}

here if i manulally paste the url ( http://localhost:4125/Loginado/welcome.aspx) it should go to login.aspx for user credentials

but its going directly to welcome.aspx page.

View 5 Replies

AJAX :: Drag A Module The Page Starts Auto Scrolling To The Top Of The Page?

Nov 17, 2010

we have implemented the ajax drag and drop which is working fine on all browsers except for chrome, In chrome when i try to drag a module the page starts auto scrolling to the top of the page.

View 1 Replies

SQL Server :: Want That Whenever User Left This Field Blank From Front End Aspx Page, Null Value Should Be Inserted In This Column From Stored Proc?

Oct 27, 2010

I have a table in sql having a numeric data type column,Now i want that whenever user left this field blank from front end aspx page, null value should be inserted in this column from stored proc.How can i achieve this? Also what kind of data type is most appropriate on front end for such taking kind of value?

View 2 Replies

Security :: HttpContext.Current.User.Identity.IsAuthenticated / Module Isn't Working

Jan 18, 2010

We have an SharePoint site no login (anonymous) with a search module using AJAX. Now the users complains that the module isn't working. When I check the code (not developed by me), I find that the code only runs if "HttpContext.Current.User.Identity.IsAuthenticated=true". Could that ever return true on an anonymous site?

View 1 Replies

Created One Exam Module Where User Will Give The Answers Of Objective Questions?

Feb 4, 2011

I have created one exam module where user will give the answers of objective questions.I have created next buttoon now i am getting first question in form load and now on click of next button shall i increase the question no +1 or some thing else.

View 1 Replies

Security :: Required Template For Managing Roles And Membership From User End In Administration Module?

Jun 16, 2010

providing template or sample code to manage users from Client side.

My Environment Details:-

Framework: 3.5

Code Behind: C#

Membership/Roles Provider: SQL Server

View 3 Replies

Urlrewriting .htm To .aspx?

Sep 28, 2010

I just finished converting a static .htm site to a .aspx/master page site for a client. They have a number of google site links (that I've blocked) that are .htm, but they're still showing up on Google. To preserve old bookmarks (and google sitelinks), I'd like to rewrite the URL from http://www.site.com/about.htm to http://www.site.com/about.aspx.

I'm using urlrewriter already, I just don't know enough about it to know how to rewrite this url. Should be pretty easy, something like:

<rewrite url="~/(*.htm)" to="~/(*.aspx)" />

but that isn't working.

View 9 Replies

C# - Using Outputcache Together With Urlrewriting

Mar 31, 2011

I've got a problem using outputcache together with urlrewriting. We've got an application that rewrites url (IE [URL]). Based on the URL (/about/) we figure out which content to show. Now we're trying to add outputcache to that page:

< %@ outputcache duration="600" location="Server" varybyparam="Custom" varybycustom="RawURL" %>

And in the Global.asax we override GetVaryByCustomString like below:

public override string GetVaryByCustomString(HttpContext context, string custom)
{
if (custom == "RawUrl")
{
return context.Request.RawUrl;
}
else
{
return string.Empty;
}
}

However, when we publish the page i'd like to invalidate the cache so that the editors see the change directly. But no matter what I try, I cannot seem to invalidate the cache. If I'd like to invalidate "/about/" I would like to do this: HttpResponse.RemoveOutputCacheItem("/about/"); That doesn't work unfortunately. The only thing that seems to work is: HttpResponse.RemoveOutputCacheItem("/page.aspx");

This clears the cache for all my pages, not just "/about/". Is there any way to invalidate the cache based on the url? Or should we provide a cache key or something per page to be able to invalidate the cache programmatically?

View 1 Replies

UrlRewriting For Subdomains?

Sep 13, 2010

In IIS7 using UrlRewrite module I want to do something likes this. I tried everywhere, possibly this is wellknown problem, but couldn't find any usefull solution.Url "http://tom.mydomain.com" should be read internally as "http://mydomain.com/dashboard?g=tom"I am using ASP.NET MVC, just in case info is required.

View 1 Replies

C# - Skip Authentication For Certain User Agents On IIS7?

Aug 30, 2010

I'm writting a software in C# and .NET to manage my store, which has a site where you can go and opt in to receive a sellers person visit. This site has an behind the scenes manager, but I want the software to do this instead, effectively removing the browser manager and the first step towards this goal is to allow the software access to a PHP script that generates tha XML file required.

The problem is, the login mechanics, written in C# and using web.config, doesn't allow the software to access the said script, which is inside a protected folder for the browser manager. I already tried using HttpWebRequest object, WebClient object with lots os combinations of post, credentials, streams and even a special user-agent to try and login, without success, I can only download the login page.

Here's the code I'm using to download data at the moment (That's my latest try, using the special header):

string agent = "AGENT"; //Not real name, it's just confidential
WebClient client = new WebClient();
client.Headers["HTTP_USER_AGENT"] = agent;
client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompletedEvtHdl);
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChangedEvtHdl);
if (!Directory.Exists(toSavePath))
{
Directory.CreateDirectory(toSavePath);
}
if (File.Exists(toSavePath + filename))
{
File.Delete(toSavePath + filename);
}
client.DownloadFileAsync(new Uri(url), toSavePath + filename);

The login page is pretty simple, it only assings a click event to the login button to check if the user and password are the same in web.config. If true, got to redirect page, else, error.

So, what's the best method for this? Is there any way to configure IIS7 to skip the authentication on that special user agent or some other custom header? Or I'm going the wrong way?

View 1 Replies







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