I want to ask about global.asax file, is it possible to edit global asax without compiled?
or any idea about other solution?
Thank You
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
MiraclePosted Sep 19, 2013, 7:29 AM
MiraclePosted Sep 19, 2013, 7:26 AM
Abhishek JainPosted Sep 19, 2013, 7:10 AM
Solution:
Although there is no such way to make changes in Global.asax and hence deploy the changes without compiling. But yes there is an alternative approach to this in which you don't have to build the whole solution again.
Create a Separate Project(Class Library) where you want to keep the Global.asax code(So whenever you need to make changes in any code, you can make changes in this project compile it and put the DLL in bin folder, this approach will not require building your whole website)
Now Add a class in this project, example:
namespace ApplicationGlobal
{
public class GlobalClass : System.Web.HttpApplication
{
//Write your events here
void Application_BeginRequest(object sender, EventArgs e)
{
//Write your code here
}
}
}
Now on the top of the Global.asax file, write following statement:
<%@ Application Inherits="ApplicationGlobal.GlobalClass" %>
Now your actual Global.asax code is present in separate library, so you can make changes in that library whenever you need to make changes in the code and your website will not need compilation everytime. After the Class Libarary is compiles copy the DLL produced in the BIN folder of the Website.
Regards
AJ
Jignesh TrivediPosted Sep 19, 2013, 7:02 AM
hi,
I think, Global.asax is embedded file and it is part of your web dll.
so you can not change it.
can please provide more information of you requirement?
so that we can help you.