|
I moved a site onto a 2008 box after having it on a 2003 server box and did some testing only to find that the redirection on an error failed to go to the error.aspx page I had. I've been googling this for quite some time to no solution.
I looked for an IIS forum, but couldn't find one. I think the solution is in IIS, but I'm not sure.
Any help would be much appreciated.
|
|
|
|
|
wolfbinary wrote: redirection on an error failed to go to the error.aspx page
So, you are redirecting on Error Page from global.asax ? Can you show us the code for Application_Error Secction ?
I guess you are using Response.Redirect From Application_Error .
This is the Problem related with IIS 7 and Its integration mode. Which mode you are using ? Integrated or Classic ?
if Its Integrated mode and change to classic it may work.
Here[^] I found a good solution [ The summary as below ]
Analysis :
The problem is caused by changed behavior of IIS7 new integrated pipeline mode when calling Response.Redirect() in Application_Error. The default .net error page will be rendered before the actual redirection occurs due to error is detected.
Solution
1. Remove the module definition of ScriptModule under system.webServer/modules in web.config. e.g:
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Remove Application_PreSendRequestHeader and Application_PreSendRequestContent event handlers from global.asax if they are not used.
2.Call Context.ClearError or Server.ClearError to clear the error before using Response.Redirect() in Application_Error .
Hope this will help you
|
|
|
|
|
I tried your above solution and you don't have to remove the config file part to get it to work. If you just clear the error and to the redirect all it well.
Thanks for the response though. It got me going in the right direction.
|
|
|
|
|
Hi..
I am using asp.net/c#.
I have used the following code for reading word document. But it reads only text data and not displaying the images in the word document.
string docname = dr["docname"].ToString();
string path= Server.MapPath("festival_doc");
string m = path + "//"+docname;
Word.ApplicationClass wordapp = new Word.ApplicationClass();
object file = m;
object nullobj = System.Reflection.Missing.Value;
Word.Document doc1 = wordapp.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
TextBox1.Text = doc1.Content.Text;
doc1.Close(ref nullobj, ref nullobj, ref nullobj);
Can anyone solve the problem?
|
|
|
|
|
TextBox1.Text = doc1.Content.Text;
The above line is why it only reads text, it is all you're asking it to. Also, the text box you're assigning to can only handle text so if you try and set the value to any other property it probably won't compile.
|
|
|
|
|
Thanks for answering!
But I need to read all the data in the word document including images and display it in web page.
Please give me the solution.
|
|
|
|
|
lagan wrote: But it reads only text data and not displaying the images in the word document.
Are you assigning the data into textbox? How can you expect a textbox to display images?
|
|
|
|
|
I have one page where I am allowing user to upload .xls file. I am storing these files on server in a folder. I have added <identity impersonate="true"> line in web.config.
After doing this above still its giving me following exception when I try to upload .xls file on the server.
|
|
|
|
|
Have you given read/write access to asp.net user on the folder where you are uploading files?
|
|
|
|
|
Hi ... sorry for distrubing u all again and again...
please suggest me any alternate method for the placeholder .
i am getting postback issue in usercontrol.. i should not use query string aswell..
Plz help me
Ramkumar
|
|
|
|
|
Your question makes no sense. If yuo get an error, tell us what it is. Post some code. Tell us what you're trying to do. This is useless. We cannot help you.
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 everybody.
Does anybody even IMAGINE why writing this in a RegisterStartupScript block would cause my textbox to lose its value upon postback???
Page.ClientScript.RegisterStartupScript(GetType(),"document.getElementById('" + txtp.ClientID + "').value; "...... etc
txtp.Text = "-1";
Let me say that one more time. I am reffering to the ClientID of "txtp" in a RegisterStartupScript. I merely take the value from it, that's all. And when the page retuns, txtp always has its default value, the one I populate in it, see the next line, when I set -1. But if I comment out that line with the .ClientID, then when the pages posts back, after I repopulate, even if I set -1 to the textbox, I DO GET THE CORRECT number in it, which was entered client-side, before the user presses the submit button.
With .Client ID line uncommented:
1. Load dynamic user control in which txtp is.
2. Set -1, register startup script
3. User writes 2 in the textbox
4. Submit
5. Value in textbox is -1.
WRONG
With .Client ID line commented:
1. Load dynamic user control in which txtp is.
2. Set -1, register startup script
3. User writes 2 in the textbox
4. Submit
5. Value in textbox is 2.
CORRECT
Somebody please help me out here....... I'm way over my head, I don't understand a bit of what is happening, even though I have studied the lifetime of the page and I am loading the control dinamically at the master's page Init.
But even if I messed something up in the lifetime, THIS STILL DOESN'T explain why a silly .Client ID messes everything up! Weird!
|
|
|
|
|
Are you sure of this.
I did this myself
this.ClientScript.RegisterStartupScript(typeof(Page),"scriptblock", "<script>var x = document.getElementById('" + txtp.ClientID + "').value; </script>");
txtp.Text = "-1";
and found 2 on txtp.Text when form is posted back.
I think the problem is every time you post back the form it resets the txtp.Text to -1 as you wrote this in Page_Load event I think.
So please write
If(IsPostBack)return; at the beginning, I think it will work properly..
|
|
|
|
|
Hi and thanks for answering Abhishek! No, this is not an IsPostBack problem. I'm not a beginner. Simply uncommenting that line will make the value reach the server again! That's the weird thing. And it works for you perhaps because you don't have that textbox in a dinamically created User Control. What I'm wondering is WHY EXACTLY uncommenting that sh*tty line makes everything work! I can't believe it!
|
|
|
|
|
Ya.. Is it so.. This is really weird. Love to see the exact scenario. If possible can you share the code with me. We can also place a bug report to Microsoft about that if it really happens...
|
|
|
|
|
hi all,
how to i send xml file to client side and than how to use this xml in javascript?
thanks
|
|
|
|
|
I couldnt get you properly. You need to send an XML, just write that in the Response.
You can use a http handler to get the XML from the server. Just call using AJAX.
You can get the elements of the XML using DomParser.
Check this one
http://www.w3schools.com/Xml/xml_parser.asp
for xml parsing.
|
|
|
|
|
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.
|
|
|
|